Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataCurve curveType change throws a warning in React's Strict Mode #1684

Closed
PeterC-DLS opened this issue Jul 30, 2024 · 0 comments · Fixed by #1687
Closed

DataCurve curveType change throws a warning in React's Strict Mode #1684

PeterC-DLS opened this issue Jul 30, 2024 · 0 comments · Fixed by #1687
Labels
bug Something isn't working

Comments

@PeterC-DLS
Copy link
Contributor

Describe the bug

There's something impure in the use of useLayoutEffect by useGeometry which shows up in StrictMode. This shows up between versions 10.0.0 and 10.1.0

To Reproduce

  1. pnpm start:storybook
  2. Click on DataCurve - this selects the Docs subitem
  3. Open the web console
  4. Change the curveType attribute to, say, "LineAndGlyphs"
  5. See this warning:
Warning: The final argument passed to useLayoutEffect changed size between renders. The order and size of this array must remain constant.

Previous: [[object Object], (frames = 1) => invalidate2(get(), frames)]
Incoming: [[object Object], 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, 400,361,324,289,256,225,196,169,144,121,100,81,64,49,36,25,16,9,4,1,0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400, function scale(x) {
    return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise2(domain.map(transform), range2, interpolate)))(transform(clamp(x)));
  }, function scale(x) {
    return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise2(domain.map(transform), range2, interpolate)))(transform(clamp(x)));
  }, , (frames = 1) => invalidate2(get(), frames)]
Glyphs@http://localhost:6006/@fs/scratch/work/3rd/h5web.git/packages/lib/src/vis/line/Glyphs.tsx:34:7
DataCurve@http://localhost:6006/@fs/scratch/work/3rd/h5web.git/packages/lib/src/vis/line/DataCurve.tsx:38:7
InteractionsProvider@http://localhost:6006/@fs/scratch/work/3rd/h5web.git/packages/lib/src/interactions/InteractionsProvider.tsx:29:7
VisCanvasProvider@http://localhost:6006/@fs/scratch/work/3rd/h5web.git/packages/lib/src/vis/shared/VisCanvasProvider.tsx:38:7
Suspense
ErrorBoundary@http://localhost:6006/node_modules/.cache/sb-vite/deps/chunk-WX34G3F2.js?v=0231e1b1:16091:5
FiberProvider@http://localhost:6006/node_modules/.cache/sb-vite/deps/chunk-WX34G3F2.js?v=0231e1b1:17700:21
Provider@http://localhost:6006/node_modules/.cache/sb-vite/deps/chunk-WX34G3F2.js?v=0231e1b1:17463:18 [react-reconciler.development.js:78:29](http://localhost:6006/node_modules/.pnpm/[email protected][email protected]/node_modules/react-reconciler/cjs/react-reconciler.development.js)
    printWarning react-reconciler.development.js:78
    error react-reconciler.development.js:52
    areHookInputsEqual react-reconciler.development.js:7308
    updateEffectImpl react-reconciler.development.js:8132
    updateLayoutEffect react-reconciler.development.js:8178
    useLayoutEffect react-reconciler.development.js:8946
    useLayoutEffect React
    useGeometry hooks.ts:117
    Glyphs Glyphs.tsx:39
    renderWithHooks react-reconciler.development.js:7363
    updateFunctionComponent react-reconciler.development.js:11802
    beginWork react-reconciler.development.js:13845
    beginWork$1 react-reconciler.development.js:19513
    performUnitOfWork react-reconciler.development.js:18686
    workLoopSync react-reconciler.development.js:18597
    renderRootSync react-reconciler.development.js:18565
    performConcurrentWorkOnRoot react-reconciler.development.js:17836
    workLoop scheduler.development.js:266
    flushWork scheduler.development.js:239
    performWorkUntilDeadline scheduler.development.js:533
    (Async: EventHandlerNonNull)
    js scheduler.development.js:571
    js scheduler.development.js:633
    __require2 chunk-GFT2G5UO.js:18
    js index.js:6
    __require2 chunk-GFT2G5UO.js:18
    <anonymous> index-5bde93f1.esm.js:6

Expected behaviour

No warning

Context

  • OS: Linux
  • Browser: Firefox
  • Version: 115/4.0esr (64-bit)
  • H5Web context: @h5web/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant