-
Notifications
You must be signed in to change notification settings - Fork 30
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
SelectCollection: make collectionNameFilter() and collectionLabel() more robust #6669
Conversation
Update: local testing show that, if I apply this code patch on top of 6667's dependency bump, the Collection Modal will display fine on Storybook. 👍 |
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.
Alrighty through more sleuthing and a brief false alarm about mobx-state-tree, we've narrowed down the effects of Grommet's upgrade to the Select component's labelKey
handler collectionLabel()
. In the diff between our current Grommet version and v2.45.0, Grommet made an enhancement to Select so that Select's that use a labelKey
handler correctly display the selected value with aria-labels. I'll attach a screenshot of the specific diff in this comment for future reference.
The Grommet change affected collectionLabel()
as the labelKey
handler because in our collections modal we're intentionally setting the default selected value as blank. Therefore, collectionLabel()
was passed an empty argument and couldn't find links.owner
on first render of the modal.
![Screenshot 2025-02-11 at 10 31 55 AM](https://private-user-images.githubusercontent.com/23665803/412071921-c8821097-570f-4094-86b7-83a5f756adc7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0ODE2MzUsIm5iZiI6MTczOTQ4MTMzNSwicGF0aCI6Ii8yMzY2NTgwMy80MTIwNzE5MjEtYzg4MjEwOTctNTcwZi00MDk0LTg2YjctODNhNWY3NTZhZGM3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDIxMTUzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJkZmYxMjczNWEyZDI2MjU2NmNkZmZiMmQzZGU0YTJkYzgwYzI2N2U5ZjE0YzI4ZWExNTEwZGFiODk3NmYxNzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.tCkc7-tJCvHRnw2fWyk2_XcFcrF7UvWSWZQWPrrj5qs)
f41f10a has been added with notes from our debug session, so future devs know what's going on. Thanks for looking into this, Delilah! 👍 |
…ore robust with respect to unexpected data
f41f10a
to
3e12dc5
Compare
Haha the tests for lib-classifier magically failed after I added a comment into the code. Alright, let's re-run that. |
PR Overview
Package:
app-project
Affects:
<SelectCollection />
This PR updates the SelectCollection component's collectionNameFilter() and collectionLabel() functions to be more robust, with respect to unexpected data.
Dev Notes
This issue was brought in Dependabot PR #6667 , where a seemingly innocent bump from Grommet 2.41.0 to 2.45.1 caused the
CollectionModal
components to suddenly fail. The issue can be traced to SelectCollection's collectionLabel() not receiving its 'collection' data in a proper format - the function's a bit brittle in that sense.<SelectCollection>
is rendered... or something. I'm going to run some manual Storybook before/after comparisons to make sure nothing's too broken.Testing
Automated tests should pass. Uh, there's no manual test for this, really.
Status
Ready for review.
Low priority 😴 since no new functionality is added, but I'll sound an alarm if it turns out that grommet bump is way more borked than we expect.
Once this is merged, Dependabot PR #6667 (or whatever new version replaces it) should be re-reviewed.