Fix search route error catch handler result being discarded#3692
Open
J8118 wants to merge 2 commits intoShopify:mainfrom
Open
Fix search route error catch handler result being discarded#3692J8118 wants to merge 2 commits intoShopify:mainfrom
J8118 wants to merge 2 commits intoShopify:mainfrom
Conversation
Contributor
|
nice find - the `.catch()` return value was being discarded, so the error fallback never actually reached the caller. the fix correctly chains the catch. since this is a skeleton template change, it needs a triple changeset bump per our repo rules. could you add one? ```md"skeleton": patch
|
Contributor
Author
|
Done — just pushed the triple-bump changeset |
The .catch() was called on searchPromise but the returned chain was not used. The original promise was awaited separately, so rejections still threw a 500 error. Now awaiting the promise with the catch handler so the fallback value is actually returned.
824c4e4 to
9025266
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
In the skeleton template's
search.tsxloader, the.catch()handler onsearchPromisereturns a fallback value, but this return value is discarded becausereturn await searchPromiseon line 33 awaits the original promise, not the one with the catch handler attached..catch()creates a new promise chain — the original promise still rejects.If
searchPromiserejects, two things happen:.catch()handler logs the error and returns a fallback (but this value goes nowhere)await searchPromisethrows, resulting in a 500 errorFile changed:
templates/skeleton/app/routes/search.tsx(lines 28-33)Before:
After: