From d1fd3c4f62b0e05f79565fc72423ba0fed5474f1 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 6 Jun 2020 22:30:45 +0200 Subject: sorting elements better... loading item on dblclick --- frontend/views/page/components/tile.edit.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'frontend/views/page/components/tile.edit.js') diff --git a/frontend/views/page/components/tile.edit.js b/frontend/views/page/components/tile.edit.js index cb339c9..2f6dad7 100644 --- a/frontend/views/page/components/tile.edit.js +++ b/frontend/views/page/components/tile.edit.js @@ -16,18 +16,27 @@ class TileEdit extends Component { state = { tile: null } + componentDidMount() { + this.load() + } + + componentDidUpdate(prevProps) { + if (prevProps.page.editor.currentEditTileId !== this.props.page.editor.currentEditTileId) { + this.load() + } + } + + load() { const { currentEditTileId } = this.props.page.editor const tile = this.props.page.show.res.tiles.filter(tile => tile.id === currentEditTileId)[0] console.log('edit', currentEditTileId) this.setState({ tile }) - // actions.tile.show(this.props.match.params.id) } handleSubmit(data) { actions.tile.update(data) .then(response => { - // response // console.log(response) if (response.status === 'ok') { this.props.pageActions.updatePageTile(response.res) -- cgit v1.2.3-70-g09d2