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(react-components): improve asset mapping cache mechanism and refactoring to stabilize rule threshold styling and switching #4652

Merged
merged 33 commits into from
Jul 11, 2024

Conversation

danpriori
Copy link
Contributor

@danpriori danpriori commented Jul 1, 2024

Type of change

Bug

Jira ticket 📘

https://cognitedata.atlassian.net/browse/BND3D-4199
https://cognitedata.atlassian.net/browse/

Description 📝

This fixes the rule threshold for large rule-based + 3d model content + asset mappings by changing the asset mapping cache system in react components and some refactoring to speed up the rule threshold applying onto the 3d models, including a loading indicator when the rule is processing, loading, and applying the styling.
Before this, the asset mapping cache was based on a list of asset IDs or node IDs that were requested at once. However, the asset IDs of the requests are not always the same, forcing the cache mechanism to request the mappings even for those cached already in a different list.
So now the cache key is based on the asset against all its mappings rather than a summed key based on a chunk of mappings.
This way it is possible to have more freedom and flexibility to use the cache without relying on a static list.

Test instructions ℹ️

1 - Open a 3D scene in Search UI that contains contextualized assets and rule based thresholds (recommend to test in a scene that contains a huge amount of geometries and asset mappings to see the changes like Celanese, for instance).
2 - Select an Rule Based Thresholds and switch to another rule.
3. Observe the loading indicator replacing the radio button while the rule is loading and the performance improvements compared with the previous version (not crashing after loaded, more stable).

Note: it is connected to the Fusion PR https://github.com/cognitedata/fusion/pull/7149 for working with the Rule Based loading indicator

Checklist ☑️

  • I am proud of this feature.
  • I have performed a self-review of my own code.
  • I have added PR type (Feat, Bug, Chore, Test, Docs, Style, Refactor) to the PR title.
  • I have manually tested this for different scenarios (different models, formats, devices, browsers).
  • I have commented my code in hard-to-understand areas.
  • I have made corresponding changes to the public documentation.
  • I have added unit and visuals tests to prove that my feature works to the best of my ability.
  • I have refactored the code for readability to the best of my ability.
  • I have checked that my changes do not introduce regressions in the public documentation.
  • I have outlined any known defects / lacking capabilities in the contents of this PR.
  • I have listed any remaining work that should follow this PR in the description or jira/miro/etc.
  • I have added TSDoc to any public facing changes.
  • I have added "developer documentation" in any package README.md that is related / applicable to this PR.
  • I have noted down and am currently tracking any technical debt introduced in this PR.
  • I have thoroughly thought about the architecture of this implementation.
  • I have asked peers to test this feature.

Copy link
Contributor

@haakonflatval-cognite haakonflatval-cognite left a comment

Choose a reason for hiding this comment

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

Some initial comments - I'll have to look a little closer on the changes in AssetMappingCache, but I think I'll wait until you've had a chance to make changes based on the comments

@danpriori danpriori marked this pull request as ready for review July 4, 2024 08:52
@danpriori danpriori requested a review from a team as a code owner July 4, 2024 08:52
Copy link
Contributor

@haakonflatval-cognite haakonflatval-cognite left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@danpriori danpriori enabled auto-merge (squash) July 11, 2024 09:38
@danpriori danpriori merged commit 7af7766 into master Jul 11, 2024
14 checks passed
@danpriori danpriori deleted the danpriori/rule-based-caching-many-asset-mappings branch July 11, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants