Commit graph

71 commits

Author SHA1 Message Date
Aria Minaei
27f918f53c Make usePrism hot-reloadable 2023-08-02 19:41:22 +02:00
Aria Minaei
d26db282c6 Fix the dropped update edge case in @theatre/react
Before this, there was a delay between when a queued microtask is finished, and it being marked as so. If an update was queued in between this delay, it would have been missed.

This wasn't caught until now, because usually in a large react tree, usually there are one or more tickers that flush the queue, so if an update isn't picked up on one flush, it would end up in the next flush.
2023-08-02 19:31:39 +02:00
Aria Minaei
5a51cb0402 0.6.2 2023-07-24 19:23:35 +02:00
Aria Minaei
2052824aca 0.6.1 2023-05-12 19:28:23 +02:00
Aria Minaei
f3f6eaad86 0.6.1-dev.5 2023-03-08 12:26:33 +01:00
Aria Minaei
93fc53c45c 0.6.1-dev.4 2023-02-06 19:40:50 +01:00
Aria Minaei
e8ac6c77ea 0.6.1-dev.3 2023-02-03 13:00:32 +01:00
Aria Minaei
5c135a3cb9 0.6.1-dev.2 2023-02-01 16:15:02 +01:00
Aria Minaei
069c87fbcf 0.6.1-dev.1 2023-02-01 12:33:53 +01:00
Aria Minaei
24af219f76 0.6.0 2023-01-25 19:04:36 +01:00
Aria Minaei
4be16f36c1 0.6.0-rc.4 2023-01-25 17:54:52 +01:00
Aria Minaei
3d44575828 0.6.0-rc.3 2023-01-25 17:20:53 +01:00
Aria Minaei
33235e9cd7 0.6.0-rc.2 2023-01-24 18:47:10 +01:00
Aria Minaei
3e65a3eaa2 0.6.0-rc.1 2023-01-24 16:24:03 +01:00
Aria Minaei
ee357b341e 0.6.0-dev.6 2023-01-24 08:53:22 +01:00
Aria Minaei
43669313c7 0.6.0-dev.5 2023-01-23 23:21:28 +01:00
Aria Minaei
ef279eddff Add tests and docs to dataverse 2023-01-21 22:04:20 +01:00
Aria Minaei
2b396a5295 0.6.0-dev.4 2023-01-16 13:53:56 +01:00
Aria Minaei
3c68ed26ad Remove Atom.set|getState() 2023-01-15 12:42:28 +01:00
Aria Minaei
c354a602a4 Remove Box in favor of Atom 2023-01-04 20:49:44 +01:00
Aria Minaei
b2116e9a5d Unify Derivation and Prism 11/n
`useDerivation()` => `usePrismInstance()`
2023-01-04 20:49:44 +01:00
Aria Minaei
27b9c96afd Unify Derivation and Prism 8/n 2023-01-04 20:49:44 +01:00
Aria Minaei
acf34d393d Unify Derivation and Prism 7/n 2023-01-04 20:49:44 +01:00
Aria Minaei
12b3f477bc Unify Derivation and Prism (1/n) 2023-01-04 20:49:43 +01:00
Aria Minaei
5c1aa1cd50 Remove Derivation.changesWithoutValues()
And replace it with `Derivation.onStale()`
2023-01-04 20:49:43 +01:00
Aria Minaei
45b548660c 0.6.0-dev.3 2023-01-04 20:35:56 +01:00
Aria Minaei
f6361e7905 0.6.0-dev.2 2023-01-02 22:34:50 +01:00
Aria Minaei
438a83d2d4 0.6.0-dev.1 2023-01-02 19:47:23 +01:00
Aria Minaei
95b329b02d 0.5.1 2022-12-31 10:54:27 +01:00
Aria Minaei
fcd3ab7ec5 0.5.1-rc.2 2022-12-07 10:24:50 +01:00
Aria Minaei
a9adc2640c 0.5.1-rc.1 2022-11-25 11:21:28 +01:00
Aria Minaei
87acdbe9ea 0.5.0 2022-09-17 18:54:11 +02:00
Aria Minaei
c97377d868 0.5.0-rc.4 2022-09-17 18:54:11 +02:00
Aria Minaei
a8176a36f7 0.5.0-rc.3 2022-07-12 18:37:04 +02:00
Aria Minaei
667f9d4fa2 Massive perf-gain in @theatre/react
Remove cold derivation reads

Prior to this commit, the first render of every `useDerivation()` resulted in a cold read of its inner derivation. Cold reads are predictably slow. The reason we'd run cold reads was to comply with react's rule of not running side-effects during render. (Turning a derivation hot is _technically_ a side-effect).

However, now that users are animating scenes with hundreds of objects in the same sequence, the lag started to be noticable.

This commit changes `useDerivation()` so that it turns its derivation hot before rendering them.

Freshen derivations before render

Previously in order to avoid the zombie child problem (https://kaihao.dev/posts/stale-props-and-zombie-children-in-redux) we deferred freshening the derivations to the render phase of components. This meant that if a derivation's dependencies changed, `useDerivation()` would schedule a re-render, regardless of whether that change actually affected the derivation's value. Here is a contrived example:

```
const num = new Box(1)
const isPositiveD = prism(() => num.derivation.getValue() >= 0)

const Comp = () => {
  return <div>{useDerivation(isPositiveD)}</div>
}

num.set(2) // would cause Comp to re-render- even though 1 is still a positive number
```

We now avoid this problem by freshening the derivation (i.e. calling `der.getValue()`) inside `runQueue()`, and then only causing a re-render if the derivation's value is actually changed.

This still avoids the zombie-child problem because `runQueue` reads the derivations in-order of their position in  the mounting tree.

On the off-chance that one of them still turns out to be a zombile child, `runQueue` will defer that particular `useDerivation()` to be read inside a normal react render phase.
2022-07-12 13:34:29 +02:00
Aria Minaei
0631d02d31 0.5.0-rc.2 2022-07-07 22:34:51 +02:00
Cole Lawrence
f1844952ea
Add initial tools for managing derivations and React compatibility (#202)
Co-authored-by: Cole Lawrence <cole@colelawrence.com>
Co-authored-by: Elliot <key.draw@gmail.com>
Co-authored-by: Aria <aria.minaei@gmail.com>
2022-06-09 19:12:40 +02:00
Aria Minaei
f8bb2d7ae6 0.5.0-rc.1 2022-06-01 15:51:33 +02:00
Aria Minaei
9d767a08ac Hotfix for the aggregate tracks not getting updated on changes
Co-authored-by: Fülöp <fulopkovacs@users.noreply.github.com>
2022-05-30 16:43:01 +02:00
Fülöp
3d10325873
Add tests for Theatre.js + popular setups in the ecosystem (#165)
This implements some basic infra for testing Theatre.js with popular setups such as npm/yarn/pnpm, webpack/vite/parcel, js/ts, etc.

So far, the only existing setup has been with create-react-app. Will add more in the future.

Co-authored-by: Fülöp <fulopkovacs@users.noreply.github.com>
Co-authored-by: Aria Minaei <aria.minaei@gmail.com>
2022-05-17 20:53:01 +02:00
Aria Minaei
5ab47c2ad2 0.4.8-dev.3 2022-04-15 13:28:14 +02:00
Fulop
949fe935cb
Improve the documentation of dataverse (#116) 2022-04-06 17:28:08 +02:00
Andrew Prifer
eff1f158bc Provide high level description for the 4 packages 2022-01-19 15:55:36 +01:00
Aria Minaei
2ddd3a1259 0.4.8-dev.2 2021-12-17 17:38:29 +00:00
Aria Minaei
607d6afe2b 0.4.8-dev.1 2021-11-25 18:39:17 +01:00
Aria Minaei
76533d9f82 0.4.7 2021-10-14 18:48:21 +02:00
Aria Minaei
de6161e1cc 0.4.7-rc.1 2021-10-08 11:42:14 +02:00
Aria Minaei
5873e65d4d More docs 2021-10-05 12:22:43 +02:00
Aria Minaei
69c6aa9af2 Lint rule changes 2021-10-02 14:12:25 +02:00
Aria Minaei
90520dfb25 Started adopting api-extractor 2021-10-02 13:48:02 +02:00