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(Submit): Make answers reactive and fix invalid mutation of computed property #1786

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

susnux
Copy link
Collaborator

@susnux susnux commented Nov 21, 2023

This fixes the root cause for the question component not updating: Non reactive answers in Submit, meaning after assigning a new value to answers[key] the watch effect was never triggered and thus the question component was never updated.
So instead use a onUpdate method to update the answers object in a way that will trigger any watch effect.

Also make getFormValuesFromLocalStorage a method instead a computed value. Previously that computed value were assigned a new value which is invalid as computed values should be constant (except for computed setter but this was none).

@susnux susnux added bug Something isn't working 3. to review Waiting for reviews labels Nov 21, 2023
@susnux susnux requested a review from Chartman123 November 21, 2023 02:02
@susnux susnux force-pushed the fix/local-storage-handling branch from a986a8b to 4273340 Compare November 21, 2023 02:03
@susnux
Copy link
Collaborator Author

susnux commented Nov 21, 2023

Works also with "other" answer:

v.mp4

@Chartman123 Chartman123 added this to the 3.4 milestone Nov 21, 2023
@susnux susnux force-pushed the fix/local-storage-handling branch from ed3b3ab to 31007d4 Compare November 22, 2023 13:37
@susnux susnux requested a review from Chartman123 November 22, 2023 13:38
@susnux susnux mentioned this pull request Nov 22, 2023
3 tasks
@susnux susnux force-pushed the fix/local-storage-handling branch from 31007d4 to 842b521 Compare November 22, 2023 16:00
@susnux
Copy link
Collaborator Author

susnux commented Nov 22, 2023

Fixed the "other" answer cache, see:

vokoscreenNG-2023-11-22_17-01-24.mp4

@susnux susnux force-pushed the fix/local-storage-handling branch from 842b521 to 13e090f Compare November 22, 2023 16:04
@susnux susnux force-pushed the fix/local-storage-handling branch from 13e090f to 02184d3 Compare November 24, 2023 00:59
@susnux susnux requested a review from Chartman123 November 24, 2023 01:00
…uted property

Setting `answers` using `.sync` is not reactive as property changes are not triggering the computed / watch effect,
so instead use a `onUpdate` method to update the `answers` object in a way that will trigger any watch effect.

Also make `getFormValuesFromLocalStorage` a method instead a computed value.
Previously that computed value were assigned a new value which is invalid as computed values should be constant (except for computed setter but this was none).

And make sure "other" answer is set correctly so it will be saved in LocalStorage

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux force-pushed the fix/local-storage-handling branch from 02184d3 to 24cfb5d Compare November 27, 2023 18:07
… add the cached text to the option

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux force-pushed the fix/local-storage-handling branch from 24cfb5d to eb7ced6 Compare November 27, 2023 18:14
@Chartman123 Chartman123 merged commit 7804920 into main Nov 27, 2023
22 checks passed
@Chartman123 Chartman123 deleted the fix/local-storage-handling branch November 27, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checkboxes/Radio buttons don't update in UI if values are loaded from LocalStorage
2 participants