test: cover legacy (non-runes) consumption for every primitive#158
Merged
Conversation
Add explicit `<svelte:options runes={false}/>` fixtures and unit tests
for each primitive (component, pooled component, action, attachment,
composable, group) confirming they interoperate with a legacy-mode
consumer. Also documents that createIntersectionObserver's getters
don't stay reactive from a legacy consumer, since Svelte's legacy
compiler untracks external getter reads.
Update the README compatibility table and composable docs to reflect
2.x's actual legacy + runes support and that one caveat.
render
Bot
temporarily deployed
to
metonym/svelte5-test-coverage-check - svelte-intersection-observer PR #158
July 5, 2026 22:31
Destroyed
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.
This adds explicit legacy-mode coverage for every primitive in the library. Each new fixture locks in <svelte:options runes={false}/> so it can't silently drift into runes mode, and a matching unit test confirms the primitive still works correctly when consumed from a non-runes parent component: the component, pooled component, action, attachment, and group all interoperate cleanly because they communicate through bind: and callback props, which legacy Svelte still tracks.
createIntersectionObserver is the one exception. It exposes intersecting/entry as plain getters, and Svelte's legacy compiler wraps such reads in untrack() since its dependency tracking is syntactic rather than signal-based. The underlying observer logic still runs correctly (once still unobserves, for example), but a legacy-mode template won't re-render when the getter's value changes. This is documented in the new test and now called out in the README, both in the compatibility table and directly under the composable's docs, with a pointer to intersectAttachment's onobserve callback as the legacy-friendly alternative.
The README compatibility table is also corrected: 2.x supports Svelte 5.29+ in both legacy and runes mode, not runes mode only, since every primitive besides the composable already worked fine from a legacy consumer.
Risk is low. This is test and documentation only, no library source changes. The main thing to watch for is if a future change to createIntersectionObserver's implementation is assumed to fix legacy reactivity without addressing the root cause (untracked getter reads), the new test will catch a false claim of support but won't itself validate any fix beyond what's asserted.