fix(react-core): degrade to source content when a runtime translation request fails during an RSC render - #2135
Closed
JoshKappler wants to merge 1 commit into
Closed
JoshKappler wants to merge 1 commit into
JoshKappler wants to merge 1 commit into
Conversation
… request fails during an RSC render In development the I18nCache rethrows lookup failures, so a rejected runtime translation request (for example a 401 from an invalid dev API key) crashed the <T> and <Tx> RSC renders instead of rendering source content. Catch the rejection in the RSC render path and log one deduplicated structured error, reusing the I18nStore error logging via a shared helper.
Contributor
Author
|
@greptileai review |
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
RscTandRscTxand crashed the React Server Component render in development; both components now catch the rejection and render source content.I18nStoreinto a sharedlogRuntimeTranslationErrormodule, so the store and the RSC render path bind to one implementation; the store keeps its per-instance dedupe set.@generaltranslation/react-core; production behavior is unchanged since the cache already logs and falls back outside development.Validation
npx vitest runon 62734ff: react-core 83 passed (17 files), gt-react 30 passed (7 files); the 4 new failure-path tests fail against the base revision's components.npx tsc --noEmitinpackages/react-core,npx oxlint, andnpx oxfmt --checkon touched paths: clean.Greptile Summary
This PR prevents failed runtime translation requests from crashing React Server Component renders by logging the error and rendering source content instead.
<T>and<Tx>.@generaltranslation/react-core.Confidence Score: 5/5
The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issues identified.
The changed RSC paths use the established undefined-target source fallback, while the extracted logger preserves existing structured logging and bounded deduplication behavior.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD RSC["RscT / RscTx render"] --> Lookup["Runtime translation lookup"] Lookup -->|Success| Target["Render translated content"] Lookup -->|Rejected| Catch["Catch lookup error"] Catch --> Log["Log structured deduplicated error"] Log --> Source["Render source content"]Reviews (1): Last reviewed commit: "fix(react-core): degrade to source conte..." | Re-trigger Greptile
Context used: