[BUGFIX] modifier destruction order varies between dev and prod - #21639
Merged
Merged
Conversation
…der tree Production builds destroy a modifier after the modifiers inside its element, because the modifier is associated with its parent destroyable when the element closes. With the debug render tree on (the default in development), addModifier also associates the modifier's state when it is created, so modifiers are destroyed in creation order instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tree With the debug render tree on, addModifier associated each modifier's state with its parent destroyable as soon as the modifier was created, so modifiers were destroyed in creation order (an element's modifier before the modifiers inside it). Without it, which is how production builds run, a modifier is associated when its element closes, so it is destroyed after the modifiers inside its element. The debug-render-tree association now happens when the element closes, next to the manager's own destroyable, so both builds use the production order. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
📊 Size reportTarball size — dist/dev 0.03%↑
dist/prod 0.03%↑
smoke-tests/v2-app-template/dist 0.03%↑
smoke-tests/v2-app-hello-world-template/dist 0.07%↑
🤖 This report was automatically generated by wyvox/pkg-size |
| vm.env.scheduleInstallModifier(modifier); | ||
| const d = modifier.manager.getDestroyable(modifier.state); | ||
| const { state } = modifier; | ||
| const d = modifier.manager.getDestroyable(state); |
|
|
||
| // For tearing down the debugRenderTree entry that addModifier created. This happens here, | ||
| // with the modifier's own destroyable, so that modifiers are destroyed in the same order | ||
| // with or without the debug render tree. |
Contributor
There was a problem hiding this comment.
are you testing with the debug render tree disabled?
I'd very much like a build flag (not runtime flag) to disable this haha
Contributor
Author
There was a problem hiding this comment.
Not especially, just the one test in this PR that explicitly forces it to off for the duration of the test.
NullVoxPopuli
approved these changes
Sep 30, 2026
ef4
added a commit
that referenced
this pull request
Sep 30, 2026
…difier order fix landed (#21639) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ef4
added a commit
that referenced
this pull request
Oct 1, 2026
- Shift 68 citations into the files the merge changed, using the new tools/remap-citations.py (hunk offsets from git diff). - Rewrite the notes that said this checkout predated a fix: §01-1.6.3, §03-4.6, §03-7.3, §05-11.1, §05-11.3, §06-10.3, §07-3.1.5 and §08-2.20 now cite the fixed code and the tests that landed with it. - STATUS: new merge base, how to keep citations current, T13 row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
The order of modifier destructors varies between dev and prod builds.
This fix ensures that dev builds use the same destruction order as production builds.
The tests record destruction order with the debug render tree enabled (the default in tests) and with it disabled and ensure that the order must be the same.
The issue was identified as part of the template-language-spec experimental branch.