-
Notifications
You must be signed in to change notification settings - Fork 18
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(react-components): remove unreferenced resources in Reveal3DResources #4481
fix(react-components): remove unreferenced resources in Reveal3DResources #4481
Conversation
30d936a
to
6562b2c
Compare
81b5254
to
13c5695
Compare
Aaaaaah, wasted soo much time
const addOptionsSet = new Set(addOptions); | ||
|
||
return models.filter((model) => { | ||
const correspondingAddOptions = [...addOptionsSet.values()].find((options) => { |
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.
[...addOptionsSet.values()]
array is created every loop, we can create this array outside the loop and use it
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.
No, because the set changes for every iteration. I can instead use a normal Array, and search+remove from it for every iteration, but it makes the code uglier, and I don't believe it's that much more efficient
const collectionAddOptionsSet = new Set(image360CollectionAddOptions); | ||
|
||
return collections.filter((collection) => { | ||
const correspondingAddOptions = [...collectionAddOptionsSet.values()].find((options) => { |
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.
same here, array is created for every loop
react-components/src/components/Reveal3DResources/typeGuards.ts
Outdated
Show resolved
Hide resolved
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.
Nice!
Minor changes
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.
Nice
Type of change
Jira ticket 📘
https://cognitedata.atlassian.net/browse/
Description 📝
When e.g. the viewer is persistent across two tabs in an application, which are using different 3D resources, we never make an effort to remove the resources that are currently present in the viewer. This seeks to rectify that
How has this been tested? 🔍
Test instructions ℹ️
Checklist ☑️