Skip to content

Conversation

@ocavue
Copy link

@ocavue ocavue commented Sep 4, 2025

In the updated $effect callback, if el isn't found during the initial render, this $effect won't trigger the isVisible rune. Even if el becomes available later, this effect won't be activated again when isVisible changes.

Why isn't el found during the first render? In our scenario, prosemirror-adapter dynamically mounts the Svelte component into a div element that isn't controlled by Svelte. When the Svelte component is mounted, $effect will be called, but the host div element isn't yet connected to the document, so document.getElementById() will return nothing. This issue was first reported in prosekit/prosemirror-adapter#163.

Minimal reproduction for this issue:

https://github.com/ocavue/meltui-pm-adapter-modal-issue

Clicking the first button should display the popover content.

Before:

m-before.mp4

After:

m-after.mp4

@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2025

⚠️ No Changeset found

Latest commit: c27c845

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

@vercel
Copy link

vercel bot commented Sep 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
next-gen Ready Ready Preview Comment Sep 4, 2025 7:23am

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