Fix hooks error. (#2000)
We were conditionally using hooks, which caused the minified error when running the prod build of React. We now use hooks before the early returns. Fixes [#2001](https://github.com/tldraw/tldraw/issues/2001) ### 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
This commit is contained in:
parent
82d10d34a5
commit
4ca4aeebe4
1 changed files with 3 additions and 3 deletions
|
@ -676,6 +676,9 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
||||||
|
|
||||||
const labelGeometry = shape.props.text.trim() ? (geometry.children[1] as Rectangle2d) : null
|
const labelGeometry = shape.props.text.trim() ? (geometry.children[1] as Rectangle2d) : null
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
|
const isEditing = useIsEditing(shape.id)
|
||||||
|
|
||||||
if (!info) return null
|
if (!info) return null
|
||||||
if (Vec2d.Equals(start, end)) return null
|
if (Vec2d.Equals(start, end)) return null
|
||||||
|
|
||||||
|
@ -693,9 +696,6 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
|
||||||
|
|
||||||
const maskId = (shape.id + '_clip').replace(':', '_')
|
const maskId = (shape.id + '_clip').replace(':', '_')
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
||||||
const isEditing = useIsEditing(shape.id)
|
|
||||||
|
|
||||||
if (isEditing && labelGeometry) {
|
if (isEditing && labelGeometry) {
|
||||||
return (
|
return (
|
||||||
<rect
|
<rect
|
||||||
|
|
Loading…
Reference in a new issue