-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews: Add apiVersion in view config #67299
base: trunk
Are you sure you want to change the base?
Conversation
This is a good start, I don't think there's a way around running the migration on each view object change but I don't see it as a huge problem with memoization in place. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
You mean something more than what this PR is doing right now? |
No, what the PR is doing should be enough :) |
I was thinking about this approach and I wonder if we can actually change the view object once it's stable? Look at this code, for example: view.filters.forEach( filter => { /* do something */ } ); Now imagine that what we did was to rename In the |
That's true and similar to the |
What?
Part of: #67274
This PR explores adding an
apiVersion
to DataViews view config for preparation for making the API stable.Right now the migration function is just an identity one, as we don't have the need for any migration.
What concerns me though is the migration cannot be an one time thing by checking
VIEW_CONFIG_API_VERSION
. The reason for this is theonChangeView
callback where consumers can update the view config externally and they could be adding/updating some previous version props. Probably the approach for this config should be a callback (likeisVersion1
or something) and not a check with a version number.Testing Instructions