-
-
Couldn't load subscription status.
- Fork 6
Fix Image Preview Bug in Search Results #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| $ next dev --turbo | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A SuggestionRemove I can push a commit that deletes the file and updates |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,7 @@ | |
| "class-variance-authority": "^0.7.1", | ||
| "clsx": "^2.1.1", | ||
| "cookie": "^0.6.0", | ||
| "dotenv": "^16.5.0", | ||
| "dotenv": "^17.2.3", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising |
||
| "drizzle-kit": "^0.31.1", | ||
| "drizzle-orm": "^0.29.0", | ||
| "embla-carousel-react": "^8.6.0", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a
typeof data === 'string'check is a step in the right direction, but it still leavesJSON.parseunguarded. If the stream yields malformed JSON, this will throw and crash the component during render. Also, since the render condition later checks!pending && data, you could still attempt to readsearchResults.querywhensearchResultsisundefined(e.g., if the data was a non-empty string that failed to parse). You should wrap parsing in atry/catchand gate rendering onsearchResultsrather thandata. This aligns with the PR goal of robust, crash-resistant parsing.Suggestion
Consider safely parsing and gating rendering on
searchResults:JSON.parsein a try/catch and ignore malformed payloads.searchResultsrather thandatato avoid accessing properties onundefined.Example:
Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion