-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Browser tab freezes, unresponsive, plus possible memory leak with form in modal (#4018) #4021
Conversation
- Fixes the bug that `Field` caused infinite recursions when both `grouped` and `horizontal` attributes were `true`, and a validation error was set. There were circular updates of the `newMessage` data field and the `message` prop of the child `Field`s. To break the loop, `watch` of the `message` prop makes sure that the contents of the new value are different from the `newMessage` data field before updating `newMessage`. Simple identity check won't work because `message` receives a brand new array every time.
- Adds new test cases that test `Field` with `grouped` and `horizontal` attributes `true`. The test would never stop due to infinite recursions if the previous fix were not applied.
- Adds the fix of `Field` freezing due to infinite recursions.
- Adds warnings of not mixing `grouped` and `horizontal` props of `Field`.
✅ Deploy Preview for buefy-org ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -69,7 +69,7 @@ export default [ | |||
}, | |||
{ | |||
name: '<code>horizontal</code>', | |||
description: 'Group label and control on the same line for horizontal forms', | |||
description: 'Group label and control on the same line for horizontal forms. Do not mix with <code>grouped</code>.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more clear way to say this? And should we also explain, in a simple form, why we shouldn't mix them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I briefly explained what will happen if we combine them. However, there would not be a reasonable explanation because it is a design flaw we have to address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DM over discord. Maybe we could discuss this flaw over the weekend?
- Better explains the reason why `group` and `horizontal` props of `Field` should not be mixed.
- Explains the issue that remains after fixing the frozen Field bug.
…h form in modal (buefy#4018) (buefy#4021) * fix(lib): infinite Field updates - Fixes the bug that `Field` caused infinite recursions when both `grouped` and `horizontal` attributes were `true`, and a validation error was set. There were circular updates of the `newMessage` data field and the `message` prop of the child `Field`s. To break the loop, `watch` of the `message` prop makes sure that the contents of the new value are different from the `newMessage` data field before updating `newMessage`. Simple identity check won't work because `message` receives a brand new array every time. * test(lib): add test cases for Field with grouped and horizontal - Adds new test cases that test `Field` with `grouped` and `horizontal` attributes `true`. The test would never stop due to infinite recursions if the previous fix were not applied. Includes adaptation for @vue/test-utils V2: - `find(Component)` → `findComponent(Component)` - `findAll(Component)` → `findAllComponents(Component)` - `.at(i)` → `[i]` when accessing an item in `findAllComponents` results. @vue/test-utils V2 returns an ordinary array - `localVue` → `global: { components }`: @vue/test-utils V2 no longer supports `localVue` - `propsData` → `props`: `propsData` still works, but prepares for possible future deprecation * docs(CHANGELOG): update unreleased log - Adds the fix of `Field` freezing due to infinite recursions. - Explains the issue that remains after fixing the frozen Field bug. * chore(docs): add warning on grouped and horizontal (Field) - Adds warnings of not mixing `grouped` and `horizontal` props of `Field`.
…h form in modal (buefy#4018) (buefy#4021) * fix(lib): infinite Field updates - Fixes the bug that `Field` caused infinite recursions when both `grouped` and `horizontal` attributes were `true`, and a validation error was set. There were circular updates of the `newMessage` data field and the `message` prop of the child `Field`s. To break the loop, `watch` of the `message` prop makes sure that the contents of the new value are different from the `newMessage` data field before updating `newMessage`. Simple identity check won't work because `message` receives a brand new array every time. * test(lib): add test cases for Field with grouped and horizontal - Adds new test cases that test `Field` with `grouped` and `horizontal` attributes `true`. The test would never stop due to infinite recursions if the previous fix were not applied. Includes adaptation for @vue/test-utils V2: - `find(Component)` → `findComponent(Component)` - `findAll(Component)` → `findAllComponents(Component)` - `.at(i)` → `[i]` when accessing an item in `findAllComponents` results. @vue/test-utils V2 returns an ordinary array - `localVue` → `global: { components }`: @vue/test-utils V2 no longer supports `localVue` - `propsData` → `props`: `propsData` still works, but prepares for possible future deprecation * docs(CHANGELOG): update unreleased log - Adds the fix of `Field` freezing due to infinite recursions. - Explains the issue that remains after fixing the frozen Field bug. * chore(docs): add warning on grouped and horizontal (Field) - Adds warnings of not mixing `grouped` and `horizontal` props of `Field`.
Fixes #
Proposed Changes
Field
makes sure that the contents of a new value fornewMessage
are different from the currentnewMessage
before updating it to avoid infinite recursions that made a browser tab freezegrouped
andhorizontal
props ofField
to the documentationRemarks
Since
Field
was not designed to turn ongrouped
andhorizontal
props simultaneously, another issue will emerge after merging this PR, where once a validation error state is set, the error state won't be reset even after correcting the input. A workaround for now is not to mixgrouped
andhorizontal
. This PR will mitigate the worst scenario anyway.