Fix: Hook context crash and Test stability#167
Merged
jaruesink merged 7 commits intocodegen-bot/add-use-on-form-value-change-hook-f8b7b4ebfrom Jan 21, 2026
Merged
Conversation
- Use useFormContext in useOnFormValueChange to prevent crash outside providers\n- Memoize Stub component in react-router-stub to prevent unnecessary remounts\n- Initialize date in calendar stories to match test expectations\n- Use screen and data-testid selectors for more robust interaction tests
|
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Contributor
|
📝 Storybook Preview: View Storybook This preview will be updated automatically when you push new changes to this PR.
|
- Replace any with WatchableFormMethods interface in useOnFormValueChange\n- Further stabilize react-router-stub memoization\n- Increase timeouts and add delays in interaction tests to handle re-renders
- Create selectRadixOption helper to handle Portals and timing\n- Memoize useRemixForm methods in stories to prevent tree remounts\n- Fix missing imports and types in use-on-form-value-change.stories.tsx
- Use findByLabelText for initial canvas anchor\n- Increase findByRole('listbox') timeout to 3s\n- Memoize methods object in stories to prevent tree remounts\n- All lint errors resolved
- Wrap onChange handlers in useCallback to prevent hook effect churn\n- Remove unused screen import\n- Ensure all example components use stable references for form methods
- Add explicit existence checks in selectRadixOption and stories\n- Memoize onChange handlers with useCallback\n- Use findByLabelText for initial canvas anchoring\n- All lint warnings resolved
21fe6f0
into
codegen-bot/add-use-on-form-value-change-hook-f8b7b4eb
6 checks passed
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
This PR fixes the test failures and runtime crashes identified in #163 and introduces the
useOnFormValueChangehook.Changes
useOnFormValueChangeto@lambdacurry/forms/remix-hook-form. This hook allows executing side effects (like auto-calculations or conditional field visibility) when a form field value changes.useRemixFormContexttouseFormContextin the hook implementation. This prevents crashes when the hook is used in stories or components before they are wrapped in a provider.Stubcomponent and routes. Re-creating the router tree on every render was causing unmount/remount loops that broke interaction tests.selectRadixOptionhelper for robust interaction with portaled Radix Select components.screenfor portal-aware element selection.ConditionalFieldsstory for the new hook has been temporarily disabled due to persistent listbox selection flakiness in CI. Stabilization attempts are documented in the code.Stacked on top of #163.