fix(signature): resolve signature component modified flag always firi… - #650
Open
TanmayGaidhani wants to merge 1 commit into
Open
fix(signature): resolve signature component modified flag always firi…#650TanmayGaidhani wants to merge 1 commit into
TanmayGaidhani wants to merge 1 commit into
Conversation
…ng with false on user draw
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.
fix(signature): resolve signature component modified flag always firing with false on user draw
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-XXXX
Description
What changed?
SignatureComponent.prototype.setValueinside Form.tsx. It temporarily interceptsthis.triggerChangeon the active component instance. IftriggerChangeis called without arguments (which standard@formio/jsdoes right after a user strokes the signature pad, causing the debounced event queue to lose the flag), it forwards the originalflagspayload containing{ modified: true }.formReadyCallbackinside a ReactuseRefto prevent the<Form />component from destroying and recreating the underlying Webform instance whenever callback references update across renders.modifiedbecomestrue.Why have you chosen this solution?
@formio/jslibrary release or affecting vanilla JS users.onFormReady={(form) => ...}).Breaking Changes / Backwards Compatibility
Dependencies
How has this PR been tested?
src/components/__tests__/Signature.test.tsxthat simulates drawing on the signature pad canvas and verifies the change is received with themodified: trueflag.npm test src/components/__tests__/Signature.test.tsx.Checklist: