-
Notifications
You must be signed in to change notification settings - Fork 81
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
KCheckbox: Remove local state management, rely on given props #744
KCheckbox: Remove local state management, rely on given props #744
Conversation
4668f92
to
300ad9c
Compare
Code changes make sense to me. But I wonder if removing the local state management is a breaking change. I would suggest to make a different PR to remove the internal state targeting to develop and explore there its implications. And leave this PR with the removal of the For example, this change breaks the docs page as it relies on the KCheckbox internal state: Compartir.pantalla.-.2024-08-26.17_00_12.mp4And there could be some other places where we could be relying on the KCheckbox internal state too (also because the |
CHANGELOG.md
Outdated
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.
Leaving a note here that before merging it'd be good to revert CHANGELOG.md changes since the new GH action will now update the CHANGELOG.md after merging this PR by pasting the changelog from the PR description. Otherwise we'd have duplicate entries.
KCheckbox had local data which are initialized to the given props for `indeterminate` and `checked` and then updated in a watcher. This resulted in that clicking a checkbox would always toggle it's `isCurrentlyChecked` value and setting `isCurrentlyIndeterminate` to false. The changes here instead have KCheckbox simply use the given prop values and does nothing to manage any internal state around whether it shows `indeterminate` and/or `checked`. This results in users of KCheckbox needing to be mindful of how they manage the values they pass into KCheckbox's props as the component will now reflect their values at all time
300ad9c
to
325a8ca
Compare
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.
lgtm!
Thank you @nucleogenesis! |
Description
KCheckbox had local data which are initialized to the given props for
indeterminate
andchecked
and then updated in a watcher. This resulted in that clicking a checkbox would always toggle it'sisCurrentlyChecked
value and settingisCurrentlyIndeterminate
to false.The changes here instead have KCheckbox simply use the given prop values and does nothing to manage any internal state around whether it shows
indeterminate
and/orchecked
.This results in users of KCheckbox needing to be mindful of how they manage the values they pass into KCheckbox's props as the component will now reflect their values at all time.
Issue addressed
This permits Studio's clipboard to have the ability to tell KCheckbox what it should be looking like.
Changelog
change
event and update whether or not the givenchecked
andindeterminate
props reflect the reality that you expect.Steps to test
Click all of the checkboxes and the states of indeterminacy vs checked-ness -- particularly in nested situations.
The most common in Kolibri is content selection. In Studio, this issue was found while debugging a problem with the Clipboard.
KOLIBRI:
STUDIO:
(optional) Implementation notes
At a high level, how did you implement this?
Does this introduce any tech-debt items?
Testing checklist
Reviewer guidance
After review
CHANGELOG.md
Comments