-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Capture element selections through useSelected #4365
Conversation
🦋 Changeset detectedLatest commit: 7ae7bd5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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 good to me, will leave up to @BrentFarese or @timbuckley for a final approval
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.
Apologies @samarsault , there's a merge conflict from a PR we landed yesterday. Could you please rebase when you have a moment. Also if you could create a changeset (see the comment in the PR) then I'll go ahead and merge into main. Thanks!
* Capture element selections (ianstormtaylor#4338) * Rebase * Add changeset
Description
Element selections were not captured by the
useSelected
hookIssue
Fixes: #4338
Example (Before)
Borrowed from #4338.
Code - https://jsfiddle.net/4c21gd5v/22/
Example (After)
Context
From the code, It seems like the Element does not have access to the SelectedContext, but all elements inside it do. So instead of inside the Element, I wrapped the SelectionContext around the element as following:
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)