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

[5.x] Fix CP nav ordering for when preferences are stored in JSON SQL columns #10809

Merged
merged 21 commits into from
Sep 24, 2024

Conversation

jesseleite
Copy link
Member

@jesseleite jesseleite commented Sep 18, 2024

At a high level, this PR changes the YAML schema in saved CP Nav preferences to use a new array format...

nav:
  reorder:
    - fields
    - content
  sections:
    ...

Reordering the old way required object key order to be preserved, but this breaks down once saved to JSON column in MySQL, and it tries to order keys alphabetically instead...

nav:
  reorder: true
  sections:
    fields: @inherit
    content: @inherit # This would end up first, because `c` comes before `f`

This new format solves that ordering issue in SQL, but should also work just fine in flat file scenarios. I have also taken care to ensure the old legacy format can still be read when building navs from existing users' preferences as well.

TODO:

  • Save new schema to YAML
    • At the section level
    • At the item level
    • At the deeper child level
  • Read new schema from YAML when building nav
    • At the section level
    • At the item level
    • At the deeper child level
  • Ensure it can still read the legacy schema when building nav
    • At the section level
    • At the item level
    • At the deeper child level
  • Tests

@jesseleite jesseleite marked this pull request as ready for review September 18, 2024 21:41
@jasonvarga jasonvarga merged commit ddbf1bb into 5.x Sep 24, 2024
19 checks passed
@jasonvarga jasonvarga deleted the fix/cp-nav-reorder-in-json branch September 24, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants