-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
Conversation
b217123
to
d315214
Compare
I moved |
@@ -101,10 +101,8 @@ export default function CreateCodeComponentDialog({ | |||
const appNode = appDom.getApp(dom); | |||
|
|||
appStateApi.update((draft) => appDom.addNode(draft, newNode, appNode, 'codeComponents'), { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
Move
selectedNodeId
andcurrentTab
state to views ofkind: '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)