-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for volatile functions #1
base: main
Are you sure you want to change the base?
Commits on Aug 18, 2024
-
Not intending to merge this. It supports my development environment on NixOS where deps like Node from Volta that dynamically link to a glibc interpreter are not executable.
Configuration menu - View commit details
-
Copy full SHA for e8f5a43 - Browse repository at this point
Copy the full SHA e8f5a43View commit details -
Scaffold the volatile source type
This introduces a new `Signal.Volatile` function. It follows the initial proposal here: tc39/proposal-signals#237 Volatile sources bring outside data into the computation graph.
Configuration menu - View commit details
-
Copy full SHA for 4d054ad - Browse repository at this point
Copy the full SHA 4d054adView commit details -
Implement cached lookups on observed volatile sources
If volatile sources are given a subscriber and the source is being watched, now it returns from cache instead of querying `getSnapshot` every time `source.get()` is invoked. This only applies while being observed. When not observed, it fetches from the snapshot function every time.
Configuration menu - View commit details
-
Copy full SHA for 90b7711 - Browse repository at this point
Copy the full SHA 90b7711View commit details -
Bust consumer caches that depend on volatile sources
This causes the cache of `Signal.Computed` to be ignored and always re-evaluate if it depends on volatile sources. We have to do this because we don't know if the underlying sources changed since the last time it evaluated. When a volatile source upgrades to non-volatile (or is removed from the dependencies list), the downstream consumers can once again cache their evaluations.
Configuration menu - View commit details
-
Copy full SHA for a1c9377 - Browse repository at this point
Copy the full SHA a1c9377View commit details -
Implement volatile change notifications
When a volatile signal is upgraded to a tracked source through `subscribe` it gets an `onChange` handler. Until this commit it was a no-op. Now the `onChange` handler causes consumers to mark the current value as dirty. There are currently no restricted contexts for `onChange`. It's conceivable we may want to restrict it.
Configuration menu - View commit details
-
Copy full SHA for 9bc421f - Browse repository at this point
Copy the full SHA 9bc421fView commit details
Commits on Aug 19, 2024
-
Add support for sources in volatile signals
Now volatile signals can depend on other signals inside `getSnapshot`. Is this desirable? I'm not sure yet, but without supporting it, there are unexpected edge cases. This is where the abstraction begins to leak a bit.
Configuration menu - View commit details
-
Copy full SHA for 75417af - Browse repository at this point
Copy the full SHA 75417afView commit details