Skip to content

Async: Values can get out of sync #17099

@dummdidumm

Description

@dummdidumm

Describe the bug

If you have a value X that causes a pending batch, and while that batch is pending cause creation of another batch which creates a new branch and therefore new template effects which also read that value X, those template effects are not correctly rescheduled once the pending batch resolves. As a result, the shown values of X get out of sync (once shows the old, once the new value).

I believe it happens because the pending batch does not know of the new effects that are created (they are not in its (maybe_)dirty arrays), therefore does not schedule them as (maybe_)dirty on revival and therefore never runs them.

Reproduction

https://svelte.dev/playground/c7e416c4b97446468ee85f3abf4bc676?version=5.41.4#H4sIAAAAAAAACn1STYvbMBD9K4O6YJuY2NCb1zEsvfXQFtpb04PjjNNhZUlI47WF0H8vSpbsd4-a9-bNG70JQvUTikbcOa8GOMwnUYqRJDrR_A6CvUlgKojySjVm6x5Qcqodeofv1QetGBU70YjWDZYMd3u1Z5qMtgxf_pI8wmj1BNm2Or8eW7PbRJPIsMIObhz3jHm2aCuPWXHF_BNWp2pbPc1Q7WFm1gq0GiQN97vQn3fLC9h1EJJEVaVNGzjjoBV4OOCoLQLThGBn5WA2t7CQlHCPaGAFUo6OCB56hkc_SSq5zGZFD2gdZnsVY7e21cXB-24uPvxmEzu_2bzghk80pr13zzVjGhP6pScGhQv8sHoih7lNMg75F02oZ85tCZ_rui6Kc0N7-eKwRqi6vQoVjfE6wkMH9X9oohSMK4uG7Yyx_OAOnsf28hJeIR_cQgoywAoxhWmsNi6_JDxo5bTErdSnfH0Tb_j68_u3rWNL6kSjz8Maizee_5SCe5ILqaNoxl46jP8Amw0uj-sCAAA

Logs

System Info

irrelevant

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions