Skip to content

Commit fbb59ba

Browse files
fix: error after view is left idle on edit views (#9709)
### What? ![CleanShot 2024-12-03 at 15 00 13](https://github.com/user-attachments/assets/63afb1cf-59ae-4ae7-8741-c98cca0134df) ### Why? `user.id` was being used as a dependency is callbacks and when the user was logged out due to inactivity the above error would throw. ### How? Added optional chaining to the dependency.
1 parent 01d5746 commit fbb59ba

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/next/src/views/LivePreview/index.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const PreviewView: React.FC<Props> = ({
256256
operation,
257257
schemaPath,
258258
setDocumentIsLocked,
259-
user.id,
259+
user?.id,
260260
setCurrentEditor,
261261
],
262262
)

packages/ui/src/views/Edit/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export const DefaultEditView: React.FC<ClientSideEditViewProps> = ({
233233
}
234234
}
235235
},
236-
[setCurrentEditor, setDocumentIsLocked, user.id],
236+
[setCurrentEditor, setDocumentIsLocked, user?.id],
237237
)
238238

239239
const onSave = useCallback(

0 commit comments

Comments
 (0)