Skip to content

test: cover legacy (non-runes) consumption for every primitive#158

Merged
metonym merged 1 commit into
masterfrom
metonym/svelte5-test-coverage-check
Jul 5, 2026
Merged

test: cover legacy (non-runes) consumption for every primitive#158
metonym merged 1 commit into
masterfrom
metonym/svelte5-test-coverage-check

Conversation

@metonym

@metonym metonym commented Jul 5, 2026

Copy link
Copy Markdown
Owner

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.

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
render Bot temporarily deployed to metonym/svelte5-test-coverage-check - svelte-intersection-observer PR #158 July 5, 2026 22:31 Destroyed
@metonym
metonym merged commit 1a27158 into master Jul 5, 2026
3 checks passed
@metonym
metonym deleted the metonym/svelte5-test-coverage-check branch July 5, 2026 22:35
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.

1 participant