Commit graph

54 commits

Author SHA1 Message Date
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
Aria Minaei
4b2a6471dc 0.4.6 2021-10-01 17:49:04 +02:00
Aria Minaei
0eec2041a3 0.4.5 2021-10-01 12:35:50 +02:00
Aria Minaei
3d56f236e1 0.4.5-dev.3 2021-10-01 12:34:11 +02:00
Aria Minaei
f3367f0719 0.4.5-dev.2 2021-10-01 12:32:38 +02:00
Aria Minaei
fcfe2cbef4 0.4.5-dev.1 2021-10-01 10:54:49 +02:00
Aria Minaei
b3945e2a61 0.4.4 2021-09-30 22:02:45 +02:00
Aria Minaei
4a12a92428 0.4.3 2021-09-30 10:29:39 +02:00
Aria Minaei
2c4b317934 0.4.2 2021-09-22 21:18:48 +02:00
Aria Minaei
2232fe5662 0.4.1 2021-09-21 21:25:28 +02:00
Aria Minaei
bfaac10632 Fixed dependency typo, based on #13 2021-09-21 21:24:11 +02:00
Nikhil Saraf
769eefb5e5
Fix type in peer deps "raect-dom" -> "react-dom"
Fix type in peer deps "raect-dom" -> "react-dom"
2021-09-20 12:01:18 -07:00
Aria Minaei
f48038d649 0.4.0 2021-09-20 11:20:50 +02:00
Aria Minaei
378d9b7abf 0.4.0-dev.20 2021-09-17 17:32:02 +02:00
Aria Minaei
a86e220bdc 0.4.0-dev.19 2021-09-14 12:43:58 +02:00
Aria Minaei
bbf77123b2 0.4.0-dev.18 2021-09-13 19:17:34 +02:00
Aria Minaei
a1712fce4a 0.4.0-dev.17 2021-09-13 18:50:52 +02:00
Aria Minaei
46f13759e5 0.4.0-dev.16 2021-09-13 18:06:01 +02:00