tldraw/apps
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
..
apps-script google meet: add hardware whiteboard integration (#3765) 2024-05-20 14:52:05 +00:00
docs Snapshots pit of success (#3811) 2024-06-03 15:58:00 +00:00
dotcom Snapshots pit of success (#3811) 2024-06-03 15:58:00 +00:00
dotcom-asset-upload cloudflare: dont cache no-cache headers (#3849) 2024-06-03 08:32:40 +00:00
dotcom-bookmark-extractor bump typescript / api-extractor (#2949) 2024-02-25 11:43:17 +00:00
dotcom-worker Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
examples editor: register timeouts/intervals/rafs for disposal (#3852) 2024-06-04 08:50:40 +00:00
health-worker Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
huppy Force interface instead of type for better docs (#3815) 2024-05-22 15:55:49 +00:00
vscode Snapshots pit of success (#3811) 2024-06-03 15:58:00 +00:00