* chore: generate CSS hash using the filename
* fix all tests but one
* slightly kludgy fix
* try this
* fix
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Consolidates our scheduling system that had diverged into two - queue_micro_task and Batch.ensure-queues and resolves some edge case race conditions related to flushSync along the way.
* fix: send `$effect.pending` count to the correct boundary
* make boundary.pending private, use boundary.is_pending consistently
* move error to correct place
* we need that error
* update JSDoc
When an async derived already has a previous promise that is still pending, we were not accessing the `then` property of the new promise. If that property access causes signals to be read, that meant that those dependencies were lost and as such the derived wouldn't rerun anymore when it should. The fix is to make sure to always access the thennable.
* fix : remove cursor manipulation for input bindings
Old Fix: Restore input binding selection position (#14649)
Current Fix: Remove unnecessary cursor manipulation as the presence of runes no longer requires special handling.
* fix : add change set to my previous commit
* Revert "fix : add change set to my previous commit"
This reverts commit 6ca8ef3f97.
* fix: revert previous changeset added new to fix lint errors
* chore : resolve lint error to fix pipeline issue
* Revert "fix: revert previous changeset added new to fix lint errors"
This reverts commit 91094949a6.
* fix: input binding to handle code in a synchronous manner
Introduced Promise.resolve to ensure that the 'set' operation completes before the 'get' operation Minimizing update delays.
* Fix: resolve cursor jumps and change sets
* better fix
* test
* changeset
* simplify
* failing test
* gah we can't fix the input in an effect, need to do it here, but after a tick so that changes have been flushed through each blocks
* add explanatory comment
* fix test
* this seems to work?
---------
Co-authored-by: Hariharan Srinivasan <hariharan.srinivasan@kadfire.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Fixes#16591
This PR introduces a check for builtin custom elements (is attribute) inside the set_custom_element_data helper in order to correctly set properties that have a setter.
Implemented by reusing the `async_body` function inside `Fragment.js`. Also removes the ability to reference a `{@const ...}` of an implicit child inside a boundary pending/failed snippet:
- existing duplication of consts can have unintended side effects, e.g. async consts would unexpectedly called multiple times
- what if a const is the reason for the failure of a boundary, but is then referenced in the failed snippet?
- what if an async const is referenced in a pending snippet? deadlock
- inconsistent with how it behaves for components where this already does not work
Implemented via the experimental flag so the behavior change only applies there as this is a breaking change strictly speaking. Also added a compiler error for this.
closes#16462
* fix: properly catch top level await errors
async errors within the template and derived etc are properly handled because they know about the last active effect and invoke the error boundary correctly as a response. This logic was missing for our top level await output.
Fixes#16613
* test
* use helper for async bodies (#16641)
* use helper for async bodies
* unused
* fix
* failing test + fix
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: skip effects inside dynamic component that is about to be destroyed
When a dynamic component was updated to a different instance and its props were updated at the same time, effects inside the component were still called with the already-changed props.
The fix is to mark the branch as skipped to never got to those effects.
Fixes#16387
* undo accidental commit
* fix: wrap `abort` in `without_reactive_context`
* only call without_reactive_context when the controller exists
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: emit `snippet_invalid_export` instead of `undefined_export` for exported snippets
* try this
* this should work
* remove some junk (this never did anything)
* add test
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* Fix double event processing (#16522)
Firefox seems to garbage collect event objects during event propagation if no global reference to the event object is kept.
That discards the __root marker set on the event object to early,
leading to duplicate processing.
* minor tweaks
---------
Co-authored-by: ComputerGuy <63362464+Ocean-OS@users.noreply.github.com>
* fix: throw on duplicate class field declarations
* doh
* handle assignment in constructor
* fix
* apply suggestion from review
* fix
* fix failing test
* don't mark_reactions inside decrement, it can cause infinite loops
* revert mark_reactions changes
* preserve DIRTY/MAYBE_DIRTY status of deferred effects
* changeset
* tweak
* - add state changes resulting from an $effect to a separate new batch
- schedule rerunning effects based on the sources that are dirty, not just rerunning them all blindly (excempting async effects which will have run by that time already)
* test
* better fix
* tests
* this fixes the last test somehow
* fix#16477
* typo
* copy over changeset from #16477
* copy over changeset from #16464
* changeset
* dedupe
* move flushing_sync check inside Batch.ensure
* unused
* flushing_sync -> is_flushing_sync
* remove flush_effects method
* dedupe declaration
* tweak
* tweak
* update comment — it _does_ feel slightly wrong, but no wronger than the rest of this cursed function
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later. If we didn't do this then the comparison of write versions would determine that the derived has a later version than the subscriber, and it would not be re-run.
Fixes#16311Fixes#15888
The prior logic was wrong because it reexecuted when something was clean, but we want to when it's not. The remaining fix was to also check the reactions: If an effect is destroyed and it was the last reaction of a derived then the derived is set to `MAYBE_DIRTY`. We therefore also need to check if the derived still has anyone listening to it, and only then reexecute it.
Fixes#16363
Fixes#16134
* Add a warning when the misuse of `reset` in an `error:boundary` causes an error to be thrown when flushing the boundary content
* Prevent uncaught errors to make test fails when they are expected and are fired during template effects flush
* reset should just be a noop after the first call
* correctly handle errors inside boundary during reset
* handle errors in the correct boundary
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
#16268 introduced a slight regression where the state is not reset completely upon compilation. It did reset warnings but not other state, which meant if file A succeeds but file B fails in the parsing state (before the state was reset for real) it would get wrong filename info. This fixes it by setting the filename at the very beginning.