Add test for ProductUpdateController form state preservation - #361
Open
mnindrazaka wants to merge 1 commit into
Open
Add test for ProductUpdateController form state preservation#361mnindrazaka wants to merge 1 commit into
mnindrazaka wants to merge 1 commit into
Conversation
Adds a regression test for the exact bug class fixed by PR #348/#349 (useForm({ values }) forcing the update form to re-sync from fetched data on every render, silently discarding in-progress edits). This locks in the current defaultValues + one-shot reset behavior for ProductUpdateController specifically, since the fix was applied via a broad refactor across 17 controllers and had no per-controller test coverage. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lf13QXF7eFkx1c9KJcbnwS
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added a test case for
useProductUpdateControllerto verify that user input is preserved when a background refetch occurs during form editing.Key Changes
ProductUpdateController.test.tsxwith a test that validates form state preservation during concurrent operationsImplementation Details
renderHookandactfrom@testing-library/reactto test the custom hook in isolationflushPromisesutility to properly await async operations within the hookhttps://claude.ai/code/session_01Lf13QXF7eFkx1c9KJcbnwS