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

fix: avoids remounting #13567

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -67,8 +67,6 @@ const ArtistArtworkFilter: React.FC<ArtistArtworkFilterProps> = props => {
]}
ZeroState={ZeroState}
userPreferredMetric={userPreferences?.metric}
// Setting the key here to enforce a remount of the component when changing pages or query parameter filters within the query.
key={match.location.pathname + match.location.search}
Comment on lines -70 to -71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I understand correctly why this causes the flashing images. Is it because forcing the ArtworkFilterContextProvider with the key prop also remounts it's children?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, key will forcibly re-render the component and anything under it. That means images will be re-loaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, then adding a key here is indeed not a good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah @dzucconi - this was the same issue that fixed things before, I (think).

Re URL state -- yep, driving by URL state, we've been talking about this for a while. It seems straight forward 🤷

>
<ArtworkFilterAlertContextProvider
initialCriteria={{ artistIDs: [artist.internalID] }}
Expand Down