Skip to content

Commit

Permalink
fix: error after view is left idle on edit views (#9709)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
JarrodMFlesch authored Dec 3, 2024
1 parent 01d5746 commit fbb59ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/views/LivePreview/index.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const PreviewView: React.FC<Props> = ({
operation,
schemaPath,
setDocumentIsLocked,
user.id,
user?.id,
setCurrentEditor,
],
)
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/views/Edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export const DefaultEditView: React.FC<ClientSideEditViewProps> = ({
}
}
},
[setCurrentEditor, setDocumentIsLocked, user.id],
[setCurrentEditor, setDocumentIsLocked, user?.id],
)

const onSave = useCallback(
Expand Down

0 comments on commit fbb59ba

Please sign in to comment.