tldraw/packages
Mitja Bezenšek 0cf6a1e464
Fix an issue with a stale editor reference in shape utils (#2295)
Fixes an issue where the editor reference in shape utils was not up to
date with the editor returned from `useEditor`. Actually, the whole util
was the incorrect one and was holding a reference to the previous
instantiation of the editor.

This only occurred in dev mode, but could also happen in other cases
where editor is created multiple times. To see the kinds of issues this
causes in dev mode you can do the following:
1. Create an image, crop it.
2. Refresh the page.
3. Select the image, then double click it to enter crop mode.
4. You will not see the cropped area of the image. You need to change
the crop slightly and then it suddenly appears. This is because this
changes props, which reruns the memoized function.

Fixes https://github.com/tldraw/tldraw/issues/2284

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Release Notes

- Fix an issue where the shape utils could have a stale reference to the
editor.
2023-12-06 16:19:57 +00:00
..
assets Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00
editor Fix an issue with a stale editor reference in shape utils (#2295) 2023-12-06 16:19:57 +00:00
state Replace getters in examples (#2261) 2023-11-28 17:33:10 +00:00
store No impure getters pt10 (#2235) 2023-11-16 12:07:33 +00:00
tldraw fix new page naming (#2292) 2023-12-06 08:54:24 +00:00
tlschema [improvements] arrows x enclosing shapes x precision. (#2265) 2023-12-01 21:34:12 +00:00
utils fix vite HMR issue (#2279) 2023-12-01 16:48:30 +00:00
validate Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00