-
Notifications
You must be signed in to change notification settings - Fork 230
fix: code quality and safety improvements #3358
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 |
|---|---|---|
|
|
@@ -24,32 +24,4 @@ export function lazy<TProps = any>( | |
| }; | ||
|
|
||
| promise = loader().then( | ||
| (mod) => { | ||
| status = 'resolved'; | ||
| result = mod.default; | ||
| triggerRender(); | ||
| }, | ||
| (err) => { | ||
| status = 'rejected'; | ||
| result = err; | ||
| triggerRender(); | ||
| }, | ||
| ); | ||
|
|
||
| throw promise; | ||
| } | ||
|
|
||
| if (status === 'pending') { | ||
| throw promise; | ||
| } | ||
|
|
||
| if (status === 'rejected') { | ||
| throw result; | ||
| } | ||
|
|
||
| const Component = result as FC<TProps>; | ||
| return Component(props as TProps & { children?: any }); | ||
| }; | ||
|
|
||
| return LazyComponent; | ||
| } | ||
| .catch(err => console.error(err)) | ||
|
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. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win Restore a valid promise expression before Line 27 starts with member access and has no left-hand expression. This causes the reported parse errors and prevents the package from compiling. Attach 🧰 Tools🪛 Biome (2.5.5)[error] 27-27: Expected an expression but instead found '.'. (parse) [error] 27-27: expected (parse) 🪛 GitHub Actions: CI / 0_build-and-test.txt[error] 27-27: tsup/esbuild build failed: Unexpected "." at the .catch(err => console.error(err)) expression. The 🪛 GitHub Actions: CI / build-and-test[error] 27-27: tsup/esbuild build failed: Unexpected "." at the .catch(err => console.error(err)) expression. The 🤖 Prompt for AI AgentsSource: Linters/SAST tools 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Do not replace rejected lazy state with logging only.
🧰 Tools🪛 Biome (2.5.5)[error] 27-27: Expected an expression but instead found '.'. (parse) [error] 27-27: expected (parse) 🪛 GitHub Actions: CI / 0_build-and-test.txt[error] 27-27: tsup/esbuild build failed: Unexpected "." at the .catch(err => console.error(err)) expression. The 🪛 GitHub Actions: CI / build-and-test[error] 27-27: tsup/esbuild build failed: Unexpected "." at the .catch(err => console.error(err)) expression. The 🤖 Prompt for AI Agents |
||
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.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Restore successful-exit handling and lifecycle cleanup.
A rejection handler does not run when
proc.exitedresolves normally. The current change therefore drops the final status update and buffered trailing line. It also removesproc.kill()on unmount, theLiveWrapperJSX return, andrenderApp(LiveWrapper), so the example cannot provide its previous UI behavior and can leave the subprocess running. (github.com)Keep the success handler, restore the effect cleanup and component return, and retain error logging as the rejection branch.
🧰 Tools
🪛 Biome (2.5.5)
[error] 67-67: Expected a statement but instead found '.catch(err => console.error(err))'.
(parse)
[error] 67-67: expected
}but instead the file ends(parse)
🤖 Prompt for AI Agents
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Blocker: complete the
proc.exitedpromise chain.Line [67] starts
.catch(...)after an unclosedproc.exited.then((code) => {. The file has an unmatched{and cannot compile. The patch also leaves the callback body removed. (github.com)Restore the callback and append
.catch(...)after});, or remove thethenopener entirely for rejection-only handling.Proposed syntax fix
🧰 Tools
🪛 Biome (2.5.5)
[error] 67-67: Expected a statement but instead found '.catch(err => console.error(err))'.
(parse)
[error] 67-67: expected
}but instead the file ends(parse)
🤖 Prompt for AI Agents
Source: Linters/SAST tools