[Feature] Refactor reference to components' instances on the root element#672
Merged
titouanmathis merged 4 commits intodevelopfrom Oct 15, 2025
Merged
[Feature] Refactor reference to components' instances on the root element#672titouanmathis merged 4 commits intodevelopfrom
titouanmathis merged 4 commits intodevelopfrom
Conversation
Using the class of a component as a key for the storage of its instance is error prone when working with inheritance, as a component with the same name can be mounted twice on a single element. Switching to using the name of the component will help stabilize this feature and is aligned with the latest evolution towards name based query for components.
Export Size@studiometa/js-toolkit
Unchanged@studiometa/js-toolkit
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #672 +/- ##
========================================
Coverage 99.18% 99.18%
========================================
Files 125 126 +1
Lines 4420 4434 +14
Branches 1185 1186 +1
========================================
+ Hits 4384 4398 +14
Misses 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
It should not always recreate instances for already existing instances.
73bda93 to
c8ffd77
Compare
c8ffd77 to
7a51eac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
No issue.
❓ Type of change
📚 Description
Using the class of a component as a key for the storage of its instance is error-prone when working with inheritance, as a class extending another will be a different key than its parent, meaning that components with the same name can be mounted twice on a single element.
Switching to using the name of the component will help stabilize this feature and is aligned with the latest evolution towards name based query for components.
__base__property on element directly.This PR also introduces the following changes:
$register()static method multiple times by reusing already existing instances instead of always recreating new onesregisterComponenthelper function📝 Checklist