Skip to content
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

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

shaunanoordin
Copy link
Member

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.

⚠️ HOWEVER, I'm not sure why Grommet 2.45.1 (or its predecessors) suddenly caused the tests to fail. Something's changing the parameters of how <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.

@shaunanoordin shaunanoordin requested a review from a team February 6, 2025 00:16
@shaunanoordin
Copy link
Member Author

Shaun, for your own reference, this is how the Collections Modal should look:

image

@coveralls
Copy link

coveralls commented Feb 6, 2025

Coverage Status

coverage: 75.591%. first build
when pulling 3e12dc5 on select-collection-robustness
into 3d3aefc on master.

@shaunanoordin
Copy link
Member Author

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. 👍

Copy link
Contributor

@goplayoutside3 goplayoutside3 left a 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

@github-actions github-actions bot added the approved This PR is approved for merging label Feb 11, 2025
@shaunanoordin
Copy link
Member Author

f41f10a has been added with notes from our debug session, so future devs know what's going on. Thanks for looking into this, Delilah! 👍

@shaunanoordin shaunanoordin force-pushed the select-collection-robustness branch from f41f10a to 3e12dc5 Compare February 11, 2025 17:28
@shaunanoordin shaunanoordin enabled auto-merge (squash) February 11, 2025 17:28
@shaunanoordin
Copy link
Member Author

Haha the tests for lib-classifier magically failed after I added a comment into the code. Alright, let's re-run that.

@shaunanoordin shaunanoordin merged commit b2203e1 into master Feb 11, 2025
8 checks passed
@shaunanoordin shaunanoordin deleted the select-collection-robustness branch February 11, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants