Skip to content

Conversation

@dummdidumm
Copy link
Member

attributes_effect and attachments are blocks since they need the managed "don't just destroy children effects"-behavior, but they're not block effects in the sense of "run them eagerly while traversing the effect tree or while flushing effects". Since the latter was the case until now, it meant that forks could cause visible UI updates.

This PR introduces a new flag to fix that. BLOCK_NON_EAGER is basically a combination of block effects (with respects to the managed behavior) and render effects (with respects to the execution timing).

Fixes sveltejs/kit#14931

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

attributes_effect and attachments are blocks since they need the managed "don't just destroy children effects"-behavior, but they're not block effects in the sense of "run them eagerly while traversing the effect tree or while flushing effects". Since the latter was the case until now, it meant that forks could cause visible UI updates.

This PR introduces a new flag to fix that. `BLOCK_NON_EAGER` is basically a combination of block effects (with respects to the managed behavior) and render effects (with respects to the execution timing).

Fixes sveltejs/kit#14931
@changeset-bot
Copy link

changeset-bot bot commented Nov 21, 2025

🦋 Changeset detected

Latest commit: 3b98a17

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@17208

* A block effect that should run as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.
* Essentially it is a combination of RENDER_EFFECT and BLOCK_EFFECT.
*/
export const BLOCK_NON_EAGER = 1 << 24;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCK_NON_EAGER is a bit of a goofy name. I think it would be better if the flags described what effects are rather than what they're not — to me it would make more sense to have a new MANAGED_EFFECT flag that applied to both block effects and managed-but-not-a-block effects. I think that would mean fewer things like the (flags & BLOCK_EFFECT) !== 0 && (flags & BLOCK_NON_EAGER) === 0 check in mark_reactions

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.

UI derived state updates during preload with experimental.async: true

3 participants