Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move selected node state to page view only #1679

Merged
merged 11 commits into from
Feb 21, 2023

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented Feb 15, 2023

Move selectedNodeId and currentTab state to views of kind: 'page', as that's the only kind of view where it makes sense to keep that state.
Also deselects node when switching to a different page or view.
As suggested in #1672 (comment)

@apedroferreira apedroferreira added core Infrastructure work going on behind the scenes enhancement This is not a bug, nor a new feature labels Feb 15, 2023
@apedroferreira apedroferreira self-assigned this Feb 15, 2023
@oliviertassinari oliviertassinari requested a deployment to move-selected-node-to-page-view - toolpad-db PR #1679 February 15, 2023 17:02 — with Render Abandoned
@apedroferreira apedroferreira marked this pull request as ready for review February 15, 2023 17:04
@apedroferreira apedroferreira marked this pull request as draft February 15, 2023 17:16
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 15, 2023 18:22 — with Render Destroyed
@apedroferreira apedroferreira marked this pull request as ready for review February 15, 2023 18:29
@apedroferreira apedroferreira requested a review from a team February 15, 2023 18:29
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 15, 2023 19:15 — with Render Destroyed
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 17, 2023
@oliviertassinari oliviertassinari requested a deployment to move-selected-node-to-page-view - toolpad-db PR #1679 February 20, 2023 18:17 — with Render Abandoned
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 20, 2023
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 20, 2023 18:19 — with Render Destroyed
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 20, 2023 18:20 — with Render Destroyed
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 20, 2023 18:50 — with Render Destroyed
@apedroferreira
Copy link
Member Author

I moved currentTab inside page views only too.

@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 20, 2023 19:00 — with Render Destroyed
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 20, 2023 19:07 — with Render Destroyed
@oliviertassinari oliviertassinari temporarily deployed to move-selected-node-to-page-view - toolpad PR #1679 February 20, 2023 19:10 — with Render Destroyed
@@ -101,10 +101,8 @@ export default function CreateCodeComponentDialog({
const appNode = appDom.getApp(dom);

appStateApi.update((draft) => appDom.addNode(draft, newNode, appNode, 'codeComponents'), {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not introduced in this PR, but is there any technical reason why update updates both the dom and the view? It feels like two different things to me

Copy link
Member Author

@apedroferreira apedroferreira Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases for the undo/redo history to work well the best is that we update the DOM and the view in the same action, especially when adding or removing nodes. Otherwise the user might end up, for example, in a page view for a page node that has been deleted. Maybe there's a better alternative though?

@apedroferreira apedroferreira merged commit 89bb210 into master Feb 21, 2023
@apedroferreira apedroferreira deleted the move-selected-node-to-page-view branch February 21, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants