gridstack.js
gridstack.js copied to clipboard
React: lazyLoad Throws Exception "Widget container not found for id:"
Subject of the issue
The React example code throws an exception whenever lazyLoad is true, whether in GridStackOptions or GridNode.
Your environment
- version of gridstack.js - 11.5.1 but also confirmed in 12.4.0 by cloning the repo and running the React example.
- which browser/OS - Chromium 142, macOS 15.6.1 (24G90)
Steps to reproduce
- clone the gridstack.js repo
- set
lazyLoad: truein demo.tsx gridOptions - start the app with
yarn:start - look for the following exceptions in the console
Investigation
- getWidgetContainer is called by GridStackRender before renderCBFn is ever called.
- Both
gridWidgetContainersMapandwidgetContainersRefare empty. widgetContaineris alwaysnull- A fatal exception is thrown
Expected behavior
The grid should render normally, and content outside the visible view port should lazy load.