Commit graph

846 commits

Author SHA1 Message Date
Aria Minaei
558882ff0a Perf: memoize AggregateKeyframeEditor 2022-07-12 13:34:29 +02:00
Aria Minaei
b37ccb1e4e Perf: first-pass at reducing number of re-renders in <NextPrevKeyframeCursors> 2022-07-12 13:34:29 +02:00
Aria Minaei
f82c9d1155 Perf: Avoid re-rendering keyframes when snap targets change 2022-07-12 13:34:29 +02:00
Aria Minaei
8f08499fb6 Perf: Memoize SingleKeyframeEditor 2022-07-12 13:34:29 +02:00
Aria Minaei
10f21224f4 Perf: Memoize useEditingToolsForSimpleProp() as it is used in several place with the same arguments 2022-07-12 13:34:29 +02:00
Aria Minaei
bac27777c4 Perf-gain: memoize the sequence editor panel's dims to avoid unnecessary re-renders 2022-07-12 13:34:29 +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
cbfc8861b5 Add comment about bundling deps in r3f/extension 2022-07-08 14:08:57 +02:00
Aria Minaei
8f1d26536b Sanitize sequence's length and subUnitsPerUnit
Possibly fixes P-173
2022-07-08 14:08:57 +02:00
Aria Minaei
ac9345ddbd Fix for OutlinePanel not being scrollable sometimes
Fixes P-179
2022-07-08 14:08:57 +02:00
Aria Minaei
7f17f985ee Fix PlayheadPositionPopover not accepting '0' as input 2022-07-08 14:08:57 +02:00
Aria Minaei
0631d02d31 0.5.0-rc.2 2022-07-07 22:34:51 +02:00
Aria Minaei
8d977ed6ba Don't minify @theatre/r3f/dist/extension.js 2022-07-07 22:34:51 +02:00
Aria Minaei
0bb97f14d3 Add @theatre/r3f to set of packages with locked version numbers 2022-07-07 22:34:51 +02:00
Aria Minaei
0e5b27d76d Add an extra test case to removePathFromObject() 2022-07-07 20:32:55 +02:00
Aria Minaei
ebf2a19900 Initialize the studio only once in tests 2022-07-07 20:32:55 +02:00
Aria Minaei
13d612f4b7 Add a helpful warning on auto-discarded scrubs 2022-07-07 20:32:55 +02:00
Aria Minaei
158923b376 Upgrade playwright and percy 2022-07-07 16:36:12 +02:00
Aria Minaei
d2ef25f8d4 Quick hack to fix the randomly breaking e2e tests 2022-07-07 16:36:12 +02:00
Aria
a9910fecba
Unsuppress useful warnings in core. (#248)
This also temporarily removes `coreLogger`'s config from the public API One reason is that we don't have many logs that could benefit from suppressing (see diff) so the experimental API would not be useful to the user yet.

Also, the default config was suppressing useful warnings. Those warnings _would_ have been dead-code-eliminated in production mode anyway, so having a separate config to suppress them in dev mode makes it confusing.

Fixes P-171
2022-07-07 10:27:21 +02:00
Aria Minaei
88df1ef004 Show a helpful warning if the user hadn't called studio.initialize() in a timely manner 2022-07-06 16:13:29 +02:00
Fülöp Kovács
fb02b297f1 Enable the preview of easing presets when the curveEditorPopover opens 2022-07-01 14:15:25 +02:00
Andrew Prifer
d1ef903355
Enable hiding the reference window (#241) 2022-06-29 15:06:24 +00:00
Andrew Prifer
2b8a1e3ed1
Fix playground live reload multiplying connections on error in Chrome and Safari (#238) 2022-06-28 22:17:37 +02:00
Andrew Prifer
a3d9892841
Relax editable TS types to allow creating editable versions of all the JSX.IntrinsicElements elements. (#237)
Enable custom editable components through relaxed typescript types
2022-06-28 16:11:28 +00:00
vezwork
2d3466ebfe Fix react fragments not having a key.
Co-authored-by: Or Fleisher <fleisher.or@gmail.com>
2022-06-28 11:14:41 -04:00
Andrew Prifer
b98c5d86b6
Fix editable TS (#235)
Fix primitive not being supported by the typings
2022-06-28 15:06:55 +00:00
Elliot
006121da91
Fix extension buttons spacing, add extension example (#229)
* Fix extension buttons spacing & styles
* Refactor extension button styles
* Clean up extension prism
2022-06-26 16:00:59 +00:00
Elliot
2854881e17
Add support for passing scalars to vector props (#228)
Co-authored-by: Andrew Prifer <AndrewPrifer@users.noreply.github.com>
2022-06-26 15:47:20 +00:00
Cole Lawrence
7b337a9731 doc(playground dev): Live reload README.md
Co-authored-by: Elliot <key.draw@gmail.com>
2022-06-24 09:52:56 -04:00
Cole Lawrence
39d897cd83 fix(SequenceEditor): horizontal scroll with shift in macOS Firefox 2022-06-24 09:52:56 -04:00
Cole Lawrence
977ddb6574 doc: Light doc comment for isPropConfigComposite 2022-06-24 09:52:56 -04:00
Cole Lawrence
df05be3c1e dev playground: Remove mention and dependency on vite 2022-06-24 09:52:56 -04:00
Cole Lawrence
2a93aa3cdc dev playground: Watch and rewrite custom index.html files 2022-06-24 09:52:56 -04:00
Cole Lawrence
aa60556046 dev: Playground "dom" offsets new boxes 2022-06-24 09:52:56 -04:00
Cole Lawrence
f70eea1c48 dev: Playground enable custom html landing page 2022-06-24 09:52:56 -04:00
Cole Lawrence
bbf7ee9244 style: Ensure consistent font-sizes for DetailPanel inputs 2022-06-24 09:52:56 -04:00
Cole Lawrence
28bd52d9e9 ux: color hex default to removeAlphaIfOpaque 2022-06-24 09:52:56 -04:00
Cole Lawrence
6dc68d9ae9 fix playground navigation by disabling live-reload for iframed 2022-06-22 14:58:15 -04:00
Cole Lawrence
92921734e9 docs: Remove redundant doc comment 2022-06-22 14:58:15 -04:00
Andrew Prifer
0e724d631d
Reference window fixes and improvements (#227) 2022-06-18 17:37:09 +02:00
Andrew Prifer
262d7d61d3
r3f fixes (#222)
* Minify r3f extension bundle, because it is expected by the React dead code elimination check, since we bundle React in it

* Add children to props, since it is required by React 18 types

* Fix getting context attributes for gl in ReferenceWindow

* Don't bundle threejs in extension

* Fix editor not responding to scene initialization

* Fix SnapshotEditor css
2022-06-18 00:59:45 +00:00
Cole Lawrence
16e255fd57
dev: Initial playground re-design (#218)
Improve the landing page for playground items.
2022-06-17 19:23:35 +00:00
Cole Lawrence
df692427ca dev: Build playground files much faster and add watch 2022-06-16 17:10:43 -04:00
Elliot
2c2e421382
Fix outline panel blocking clicks incorrectly (#223)
Co-authored-by: Fülöp Kovács <kovacs.fulop@gmail.com>
Co-authored-by: Cole Lawrence <cole@colelawrence.com>
2022-06-16 16:14:51 +02:00
Cole Lawrence
4e4b8f83e9
Disable usePresence flags by default (#226) 2022-06-16 11:59:09 +00:00
Cole Lawrence
e8c8168f0b
UX: Add "PresenceFlag" item indicators (usePresence) (#184)
* feat/dev: Add usePresence and enable for keyframes & keyframe cursors
 * Enable hovered styles for AggregateKeyframeDot
 * Enable hovered styles for graph editor keyframes
2022-06-15 11:36:57 +00:00
Cole Lawrence
87070bcdf3 dev playground: Start dev server even if first build is error + remove redundant error logs 2022-06-13 11:27:36 -04:00
Cole Lawrence
d4f572a744 feat: Add inline keyframe editing in graph editor 2022-06-13 10:03:09 -04:00
Andrew Prifer
c303748ca9 Fix transparencies in non-backdrop-blur browsers 2022-06-13 15:39:26 +02:00