tldraw/apps/examples/src
Mime Čuvalo aadc0aab4d
editor: register timeouts/intervals/rafs for disposal (#3852)
We have a lot of events that fire in the editor and, technically, they
can fire after the Editor is long gone.
This adds a registry/manager to track those timeout/interval/raf IDs
(and some eslint rules to enforce it).

Some other cleanups:
- `requestAnimationFrame.polyfill.ts` looks like it's unused now (it
used to be used in a prev. revision)
- @ds300 I could use your feedback on the `EffectScheduler` tweak. in
`useReactor` we do: `() => new EffectScheduler(name, reactFn, {
scheduleEffect: (cb) => requestAnimationFrame(cb) }),`
and that looks like it doesn't currently get disposed of properly.
thoughts? happy to do that separately from this PR if you think that's a
trickier thing.

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [x] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [x] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know


### Test Plan

1. Test async operations and make sure they don't fire after disposal.

### Release Notes

- Editor: add registry of timeouts/intervals/rafs

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-06-04 08:50:40 +00:00
..
examples editor: register timeouts/intervals/rafs for disposal (#3852) 2024-06-04 08:50:40 +00:00
hooks ban using @internal items in examples (#3746) 2024-05-14 08:49:28 +00:00
icons New vite-based examples app (#1226) 2023-05-05 13:10:36 +00:00
misc Measure action durations and fps for our interactions (#3472) 2024-05-08 10:06:05 +00:00
ExamplePage.tsx examples: add filter input (#3625) 2024-04-27 11:13:38 +00:00
examples.tsx Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
index.html [dx] Allow vscode to search inside md files by default (#3105) 2024-03-11 14:08:04 +00:00
index.tsx ban using @internal items in examples (#3746) 2024-05-14 08:49:28 +00:00
styles.css docs: smaller snapshot so it doesnt crash (#3768) 2024-05-17 13:11:52 +00:00
vite-env.d.ts add descriptions to examples (#2375) 2023-12-27 17:17:18 +00:00