390c45c7eb
This is an attempt at #1989. The big issue there is when `shapeUtils` change when you're relying on tldraw to provide you with the store instead of providing your own. Our `useTLStore` component had a bug where it would rely on effects & a ref to detect when its options had changed whilst still scheduling updates. Fresh opts would come in, but they'd be different from the ones in the ref, so we'd schedule an update, so the opts would come in again, but they'd still be different as we hadn't run effects yet, and we'd schedule an update again (and so on). This diff fixes that by storing the previous opts in state instead of a ref, so they're updating in lockstep with the store itself. this prevents the update loop. There are still situations where we can get into loops if the developer is passing in custom tools, shapeUtils, or components but not memoising them or defining them outside of react. As a DX improvement, we do some auto-memoisation of these values using shallow equality to help with this issue. ### Change Type - [x] `patch` — Bug fix ### Test Plan - [x] Unit Tests ### Release Notes - Fixes a bug that could cause crashes due to a re-render loop with HMR #1989
52 lines
1.2 KiB
JSON
52 lines
1.2 KiB
JSON
{
|
|
"name": "examples.tldraw.com",
|
|
"description": "A tiny little drawing app (development).",
|
|
"version": "2.0.0-alpha.11",
|
|
"private": true,
|
|
"packageManager": "yarn@3.5.0",
|
|
"author": {
|
|
"name": "tldraw GB Ltd.",
|
|
"email": "hello@tldraw.com"
|
|
},
|
|
"homepage": "https://tldraw.dev",
|
|
"license": "Apache-2.0",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/tldraw/tldraw"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/tldraw/tldraw/issues"
|
|
},
|
|
"keywords": [
|
|
"tldraw",
|
|
"drawing",
|
|
"app",
|
|
"development",
|
|
"whiteboard",
|
|
"canvas",
|
|
"infinite"
|
|
],
|
|
"scripts": {
|
|
"dev": "vite --host",
|
|
"build": "vite build",
|
|
"lint": "yarn run -T tsx ../../scripts/lint.ts",
|
|
"e2e": "playwright test -c ./e2e/playwright.config.ts",
|
|
"e2e-ui": "playwright test --ui -c ./e2e/playwright.config.ts"
|
|
},
|
|
"dependencies": {
|
|
"@babel/plugin-proposal-decorators": "^7.21.0",
|
|
"@playwright/test": "^1.38.1",
|
|
"@tldraw/assets": "workspace:*",
|
|
"@tldraw/tldraw": "workspace:*",
|
|
"@vercel/analytics": "^1.0.1",
|
|
"lazyrepo": "0.0.0-alpha.27",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"react-router-dom": "^6.9.0",
|
|
"vite": "^4.3.4"
|
|
},
|
|
"devDependencies": {
|
|
"@vitejs/plugin-react": "^4.2.0",
|
|
"dotenv": "^16.0.3"
|
|
}
|
|
}
|