Skip to content

fix: missing hasBeenSeen variable definition in IsInViewport docs example#404

Open
jfreyberg wants to merge 1 commit intosvecosystem:mainfrom
jfreyberg:fix-missing-is-in-viewport-variable-in-docs-example
Open

fix: missing hasBeenSeen variable definition in IsInViewport docs example#404
jfreyberg wants to merge 1 commit intosvecosystem:mainfrom
jfreyberg:fix-missing-is-in-viewport-variable-in-docs-example

Conversation

@jfreyberg
Copy link

@jfreyberg jfreyberg commented Feb 22, 2026

This example in the documentation has been added with this PR that added support for the once parameter:

<script lang="ts">
	import { IsInViewport } from "runed";

	let targetNode = $state<HTMLElement>()!;
	const inViewport = new IsInViewport(() => targetNode, {
		once: true
	});
</script>

<div bind:this={targetNode} class="transition" class="transition-opacity {hasBeenSeen ? 'opacity-100' : 'opacity-0'}">

However, the hasBeenSeen variable is not defined in this example. Adding a const hasBeenSeen = $derived(inViewport.current); makes the example code valid.

@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2026

⚠️ No Changeset found

Latest commit: ce5addb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jfreyberg jfreyberg marked this pull request as ready for review February 22, 2026 13:32
@jfreyberg jfreyberg changed the title fix: missing hasBeenSeen variable definition in IsInViewport docs example fix: missing hasBeenSeen variable definition in IsInViewport docs example Feb 22, 2026
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