DSingh0304 commented on PR #3274:
URL: 
https://github.com/apache/apisix-dashboard/pull/3274#issuecomment-4117936808

   > > > Hi @DSingh0304,
   > > > I tested the SchemaForm demo and was able to reproduce the issue where 
switching between schema branches (oneOf / anyOf / if-then-else) retains stale 
field values in the form state.
   > > > I worked on a fix for this by implementing branch-aware cleanup inside 
SchemaForm. Instead of relying only on `shouldUnregister`, the solution 
explicitly unregisters fields that are no longer part of the active schema 
branch.
   > > > ### Solution
   > > > ```
   > > > * Tracks active schema branch paths
   > > > 
   > > > * Automatically calls `unregister` on fields from previous branches
   > > > 
   > > > * Works for:
   > > >   
   > > >   * oneOf
   > > >   * anyOf
   > > >   * if/then/else
   > > >   * dependencies
   > > > ```
   > > > 
   > > > 
   > > >     
   > > >       
   > > >     
   > > > 
   > > >       
   > > >     
   > > > 
   > > >     
   > > >   
   > > > ### Testing
   > > > ```
   > > > * Verified via `/schema_form_demo`
   > > > 
   > > > * Switching branches correctly removes stale values
   > > > 
   > > > * No regression in existing behavior
   > > > ```
   > > > 
   > > > 
   > > >     
   > > >       
   > > >     
   > > > 
   > > >       
   > > >     
   > > > 
   > > >     
   > > >   
   > > > I’d be happy to open a PR or contribute to the existing one if this 
approach aligns with the project direction. Please let me know your thoughts.
   > > 
   > > 
   > > Hey @Jaswanth-arjun I have fixed that issue in these recent commits, 
thank you for reporting the issue and i have added the test for it as well. I 
will update the PR description, proposal and screenshot and video proof as well.
   > 
   > Thanks for the update! @DSingh0304
   > 
   > I also worked on this issue and implemented a similar branch-cleanup 
approach with additional testing locally.
   > 
   > I’d be happy to help further improve this PR. Possible areas I can 
contribute:
   > 
   >     * Additional edge-case testing (nested schemas, repeated switching)
   > 
   >     * Performance improvements for large schemas
   > 
   >     * UI/UX improvements for generated forms
   > 
   >     * Documentation improvements for SchemaForm behavior
   > 
   > 
   > Please let me know if I can help with anything here.
   
   Yes sure I will let you know if I need any help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to