This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
Fix error report for search result item requests #647
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to
onedrive-vercel-index/utils/fetchWithSWR.ts
Lines 18 to 20 in 152380b
When an error occurs from item API, as for the error reporting code
onedrive-vercel-index/components/SearchModal.tsx
Line 116 in 152380b
here
error
is not astring
but{ status: number; message: any }
Since the error object is passed into the sub component like
onedrive-vercel-index/components/SearchModal.tsx
Line 121 in 152380b
And the
itemDescription
prop is directly used in{}
likeonedrive-vercel-index/components/SearchModal.tsx
Lines 106 to 108 in 152380b
which is disallowed for an object other than a string, a React children-related error will be raised if the item API returns an error, which is fixed in the PR.