Skip to content

Commit

Permalink
Fix sentry errors with can not read property of undefined (#4332)
Browse files Browse the repository at this point in the history
  • Loading branch information
poulch committed Jun 21, 2024
1 parent b2ed0b3 commit 7ac3a40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-pillows-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Fix error related to can not read property of undefined in metadata and reading search page info
3 changes: 2 additions & 1 deletion src/hooks/makeTopLevelSearch/makeTopLevelSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function makeTopLevelSearch<
result.loadMore(
(prev, next) => {
if (
prev.search.pageInfo.endCursor === next.search.pageInfo.endCursor
prev.search?.pageInfo?.endCursor ===
next.search?.pageInfo?.endCursor
) {
return prev;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/handlers/metadataCreateHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function createMetadataCreateHandler<T extends MetadataFormData, TError>(
}
}

if (data.privateMetadata.length > 0) {
if (data?.privateMetadata?.length > 0) {
const updatePrivateMetaResult = await setPrivateMetadata({
variables: {
id,
Expand Down

0 comments on commit 7ac3a40

Please sign in to comment.