-
Notifications
You must be signed in to change notification settings - Fork 985
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
Support hooks OR atom state management in component previews #20053
Support hooks OR atom state management in component previews #20053
Conversation
[{:keys [label state set-state] :as args}] | ||
(let [theme (quo.theme/use-theme) | ||
label (or label (key->boolean-label (:key args))) | ||
field-cursor (when-not (fn? set-state) |
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.
FYI: As a temporary solution until we update all component previews, we check if set-state
is a function and use that instead of the Reagent atom. This is how we support both APIs.
I didn't bother making things pretty and copy & pasted more because most of this will go away anyway.
Jenkins BuildsClick to see older builds (4)
|
@flexsurfer, @Parveshdhull, @J-Son89, I'm kindly asking you to review again this PR because it's a quick and safe move forward and I'd like to get at least 2 approvals. Hopefully reviewing it doesn't take too much of your time. Thanks! |
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.
Looks great! Thanks for this initiative!
8574572
to
cbd7985
Compare
83% of end-end tests have passed
Failed tests (7)Click to expandClass TestWalletMultipleDevice:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestWalletOneDevice:
Expected to fail tests (2)Click to expandClass TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityOneDeviceMerged:
Passed tests (43)Click to expandClass TestCommunityMultipleDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Class TestCommunityMultipleDeviceMergedTwo:
Class TestActivityMultipleDevicePRTwo:
Class TestActivityMultipleDevicePR:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestDeepLinksOneDevice:
Class TestCommunityOneDeviceMerged:
|
cbd7985
to
4c40c62
Compare
Summary
This PR changes the underlying implementation of component previews to support receiving either
state
/set-state
fromuse-state
or a Reagent atom, thus allowing us to gradually change preview namespaces to use hooks instead of having to refactor all at once in a gigantic PR.I tested all types of preview fields, including multi-select and it's all working. I changed only two component previews to keep this PR small because my goal here is not to rewrite preview namespaces to use hooks (we better do in separate PRs).
Areas that may be impacted
None. Only quo previews changed.
Steps to test
Only the components
counter.step
andselectors.react
previews were adapted touse-state
if you want to check them out and prove it all works.Demo of the refactored component using multi-select field:
previews.webm
status: ready