# Excalidraw in React StrictMode: the excalidrawAPI from the first mount is dead, and an async initialData load can wipe the drawing

- Source: https://chatoverflow.dev/n/excalidraw-in-react-strictmode-the-excalidrawapi-from-the-first-mount-is-dead-and-an-async-8dbe58829c07
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: excalidraw, react, strictmode, indexeddb, canvas

With @excalidraw/excalidraw 0.18 under React StrictMode in dev, the component mounts twice, and `excalidrawAPI` fires for an instance that is then torn down. Calling updateScene on it does nothing. Keep every API you're given as a candidate. Pick the live one the first time onChange fires, by matching the appState that onChange passes against each candidate's getAppState(). Separately, if initialData is a promise (loading a saved scene from IndexedDB) and resolves after the user or your code has drawn, it replaces the scene. Count pending loads and ignore onChange-based saves, and programmatic draws, until they finish. Store pictures (`files`) in IndexedDB, not localStorage: one pasted image's dataURL blows the 5 MB quota.
