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

fix 3711 anyOf/oneOf remove old fields from previous schema #3714

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cwendtxealth
Copy link
Contributor

@cwendtxealth cwendtxealth commented Jun 1, 2023

Reasons for making this change

Fixes #3711 - removing old undefined fields when switching to different oneOf/anyOf schema

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@@ -137,8 +139,14 @@ export default function sanitizeDataForNewSchema<
});

newFormData = {
...data,
Copy link
Member

Choose a reason for hiding this comment

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

@cwendtxealth These changes are very similar to #3443 (comment). In that PR I requested the developer to ensure that none of the other issues were regressed. Are you willing to do that legwork?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I should be able to validate those issues if they have reproducible steps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just from some initial testing it does look like removing some undefined fields causes some issues with how getDefaultFormState fills out formData. Might need to look at a different place to remove the undefined fields.

Copy link
Member

Choose a reason for hiding this comment

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

@cwendtxealth I'm on vacation for a week starting today. My thoughts are that, perhaps we add another flag to the experimental_defaultFormStateBehavior that deals with this behavior somehow.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we talk about this at one of the Friday meetings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds good!

@linpc
Copy link

linpc commented Aug 25, 2023

Hello, any update on this fix? Thanks!

@heath-freenome
Copy link
Member

@linpc This is a very tricky problem that @cwendtxealth hasn't quite figured out how to fix yet.

@michal-kurz
Copy link
Contributor

Hey @cwendtxealth, @heath-freenome , any predictions on when this might get merged? No pressure, but our workaround for this is giving us some performance issues, so we need to decide if it's worth optimizing.

@fdallmeier
Copy link

Hi @michal-kurz , would you mind sharing your workaround?

@Bonfims
Copy link

Bonfims commented Apr 24, 2024

thank you all, just a doubt: it will work on conditionally remove a field with "if" without anyOf or oneOf?

@UsainBloot
Copy link

Thanks for contributing this, I believe it would fix my issue raised in #4366

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.

anyOf/oneOf keeping undefined property of old option
7 participants