-
Notifications
You must be signed in to change notification settings - Fork 96
Add basic migration support to layout system #9113
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
pierremtb
left a comment
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.
Alright dope, not a migration expert but this looks all sound! Thanks for the extensive testing too!
| } | ||
| export type Layout = SimpleLayout | SplitLayout | PaneLayout | ||
|
|
||
| type LayoutVersion = `v${number}` |
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.
TIL
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.
Haha I probably should have made it just a number but I goofed from the jump naming the first "v1" 🤦🏻
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.
I guess it could just be a string. Who cares what the version string is
andrewvarga
left a comment
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.
I think it's really nice to try to keep user's layouts, to be honest at first I would have thought that especially if version changes are rare it's much easier to just live with the fact that users need to reconfigure their layouts every once in a while,
Yeah @andrewvarga I expect these versions will slow down tremendously in the future. One of the issues that I want to solve with this is for cases like the Bodies pane (#7564), which will update the Feature Tree pane everyone is used to to be its own Split layout with the operations list up top and the new bodies list below. I don't have a way to ship that update to users without blowing away their layout today. So this little system makes it so we can write a migration that switches in the bodies pane, increment the version, and users will get it when they open the app without losing the other stuff they've configured. We haven't provided any affordance to "reconfigure their layout" in major ways yet, like adding a Split for example. |
That totally makes sense and it will be appreciated by users I think! Also, confirmed those 2 issues look fixed now! |
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.
Weird screenshot diff, I don't see any visual difference.
To support my work on #7564, I need a proper way to get users with persisted layout configs out there to migrate to new layout configurations. This provides a first pass at such a system.
How it works
Mapwith keys of target versions and values with the outcome version and an array of migrations to apply is defined. Developers will add to this map over time, and likely remove earlier items after version are no longer seen in the wild.trueto match on all nodes.This PR introduces our first migration from
v1tov2. In it, we apply no transformations. Only the version number should increment. In the demo below I show a contrived example of adding a migration fromv2tov3.Demo
Screenshare.-.2025-12-01.10_28_42.AM-compressed.mp4