Skip to content

Commit 6f24826

Browse files
committed
adopt new excalidrawAPI prop
1 parent 95cd479 commit 6f24826

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

webview/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default function App(props: {
8282
files?: BinaryFiles
8383
) => void;
8484
}) {
85-
const excalidrawRef = useRef<ExcalidrawImperativeAPI>(null);
85+
const [excalidrawAPI, setExcalidrawAPI] = useState<ExcalidrawImperativeAPI>();
8686
const libraryItemsRef = useRef(props.libraryItems);
8787
const { theme, setThemeConfig } = useTheme(props.theme);
8888
const [imageParams, setImageParams] = useState(props.imageParams);
@@ -121,7 +121,7 @@ export default function App(props: {
121121
return;
122122
}
123123
libraryItemsRef.current = libraryItems;
124-
excalidrawRef.current!.updateLibrary({
124+
excalidrawAPI?.updateLibrary({
125125
libraryItems,
126126
merge: message.merge,
127127
openLibraryMenu: !message.merge,
@@ -157,7 +157,7 @@ export default function App(props: {
157157
return (
158158
<div className="excalidraw-wrapper">
159159
<Excalidraw
160-
ref={excalidrawRef}
160+
excalidrawAPI={(api) => setExcalidrawAPI(api)}
161161
UIOptions={{
162162
canvasActions: {
163163
loadScene: false,

0 commit comments

Comments
 (0)