[Bugfix] Fix AbstractSliderChild crash with js-toolkit >= 3.4.3#506
Open
antoine4livre wants to merge 4 commits into
Open
[Bugfix] Fix AbstractSliderChild crash with js-toolkit >= 3.4.3#506antoine4livre wants to merge 4 commits into
antoine4livre wants to merge 4 commits into
Conversation
Replace `$parent` with `$closest('Slider')` in all Slider child
components to fix TypeError when `$parent` returns null during mount.
Defer `$on` subscription in `mounted()` with `nextFrame` to ensure
the parent Slider is registered before the child looks it up.
Bump @studiometa/js-toolkit to ^3.5.0 for `$closest` support.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Migrate AccordionItem to use `$closest('Accordion')` instead of
the deprecated `$parent` property, consistent with js-toolkit 3.5.0
deprecation of `$parent` in favor of `$closest()`.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
a970187 to
bd8a1d5
Compare
Export Size@studiometa/ui
Unchanged@studiometa/ui
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #506 +/- ##
============================================
- Coverage 73.82% 73.61% -0.22%
Complexity 145 145
============================================
Files 93 93
Lines 2663 2672 +9
Branches 445 449 +4
============================================
+ Hits 1966 1967 +1
- Misses 608 612 +4
- Partials 89 93 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Trigger an initial `update()` call right after subscribing to the Slider's `index` event in `nextFrame`, so children like SliderDots correctly reflect the active slide on mount. Co-Authored-By: Claude Opus 4.6 <[email protected]>
titouanmathis
requested changes
Jun 30, 2026
| */ | ||
| update(index: number) { | ||
| if (this.$options.contain && !this.$parent.$options.contain) { | ||
| if (!this.slider) return; |
Contributor
There was a problem hiding this comment.
Prefer destructuring slider as a constant to avoid repeated lookups.
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
#505
❓ Type of change
📚 Description
Problem
AbstractSliderChild.mounted()callsthis.$parent.$on("index", this)which throwsTypeError: Cannot read properties of null (reading '$on')with@studiometa/js-toolkit>= 3.4.3.In js-toolkit 3.4.3,
$parentchanged from a property assigned during mounting to a dynamic getter that looks up registered instances at runtime. This getter can returnnullwhen a child'smounted()runs before the parent Slider is fully resolved in the instance registry.Any page using
SliderBtn,SliderCount,SliderDots, orSliderProgresscrashes on mount.Changes
Commit 1 — Fix Slider child components
this.$parentwith aslidergetter usingthis.$closest('Slider')inAbstractSliderChildand all subclasses (SliderBtn,SliderDots,SliderProgress)$onsubscription inmounted()withnextFrameto ensure the parent Slider is registered before the child looks it up@studiometa/js-toolkitto^3.5.0(required for$closestsupport)Commit 2 — Fix AccordionItem
this.$parentwiththis.$closest('Accordion')inAccordionItem.mounted(), consistent with the js-toolkit 3.5.0 deprecation of$parentOut of scope
Frame.ts:this.$root.$update()— deprecated but does not crash. Replacing withthis.$update()would change behavior (only updates the Frame subtree instead of the entire app). Needs a separate discussion.$children(22 usages across 11 files) — deprecated in favor of$query()but still functional. Migration should be handled in a dedicated ticket.📝 Checklist