fix(app-shell,core): keep error-envelope objects out of toast.error — React #31 page crash#2580
Open
baozhoutao wants to merge 1 commit into
Open
fix(app-shell,core): keep error-envelope objects out of toast.error — React #31 page crash#2580baozhoutao wants to merge 1 commit into
baozhoutao wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
… React #31 page crash (#2579) A failed api/flow/server action returning the ObjectStack envelope `{ error: { code, message } }` rode the error OBJECT through `result.error` into ActionRunner's post-execution toast, and `toast.error(object)` rendered it as a React child — Minified React error #31 inside flushSync took down the whole page (reported from Setup → Create User's 400, objectstack-ai/framework#3031). Two layers so no single handler bug can crash the page again: - sources: shared errorDetail() in useConsoleActionRuntime flattens the envelope to a string (error string → error.message → message → HTTP fallback) across apiHandler / flowHandler / serverActionHandler; - sink: ActionRunner coerces a non-string result.error to its .message (or a generic string) before calling the toast handler.
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.
Closes #2579.
Problem
A failed
api/flow/server-actionaction returning the ObjectStack envelope{ success: false, error: { code, message } }crashed the whole console page instead of showing an error toast: the error object roderesult.errorintoActionRunner.handlePostExecution→toast.error(object)→ sonner rendered it as a React child → Minified React error #31 insideflushSync, uncaught, page down. Reported from Setup → Create User's 400 (server half: objectstack-ai/framework#3031, fixed in objectstack-ai/framework#3033).Fix — two layers
packages/app-shell/src/hooks/useConsoleActionRuntime.tsx): new module-levelerrorDetail(body, fallback)flattens an error body to a string —errorstring →error.message→message→ HTTP-status fallback — applied to the three handlers that previously did(body as any)?.error || …(apiHandler, flowHandler, serverActionHandler).packages/core/src/actions/ActionRunner.ts): the error-toast sink coerces a non-stringresult.errorto its.message(or a generic'Action failed') before calling the toast handler, so no future handler bug can take the page down again.Testing
HTTP <status>when the body is unusable; ActionRunner coerces a leaked object at the sink (with-message and without-message cases).vitest runon the two touched test files: 88/88 pass.Browser-level verification will land with the next
.objectui-shapin bump in framework (the console bundle is built at the pinned SHA, so an uncommitted worktree can't be smoke-tested in the dogfood console).