GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — fix(tui): apply default duration when toast.show called without duration by Bojun-Vvibe · Pull Request #23938 · anomalyco/opencode ConversationSummaryFixes #23613 — the "Copied to clipboard" toast (and any other toast whose caller does not pass Root cause
show(options: ToastOptions) { const { duration, ...currentToast } = options setStore("currentToast", currentToast) if (timeoutHandle) clearTimeout(timeoutHandle) timeoutHandle = setTimeout(() => { setStore("currentToast", null) }, duration).unref() } The 5000ms default is declared only on the zod schema in duration: z.number().default(5000).optional().describe("Duration in milliseconds") …but All
So they hit The regression was introduced when the toast was rewritten in SolidJS / opentui as part of #23175 — the previous Go TUI toast didn't share this codepath. FixApply the same 5000ms default at the call site, so the zod-side default and runtime behavior agree: - }, duration).unref() + }, duration ?? DEFAULT_DURATION_MS).unref() Hoisted the literal into a Verification
NotesI considered the alternative of running the schema through
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe new SolidJS toast (introduced when the TUI was migrated away from Go) reads `duration` from `ToastOptions` directly without ever running the zod schema, so callers that omit `duration` (e.g. all 'Copied to clipboard' toasts in selection.ts, app.tsx, dialog-provider.tsx, and session/index.tsx) end up calling `setTimeout(fn, undefined)`. Node treats that as the minimum 1ms delay, causing the toast to flash and disappear almost immediately. The 5000ms default lives only on the zod schema (`event.ts`) and never reaches runtime because the schema is only used for type inference. Apply the same default at the call site so toasts stay visible for the intended duration. Fixes anomalyco#23613
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. …time Replace the local DEFAULT_DURATION_MS constant in toast.tsx with a shared TOAST_DEFAULT_DURATION_MS exported from event.ts, and reference it from the ToastShow schema's .default(). This keeps the schema-declared default and the runtime fallback as a single source of truth, so future changes stay in sync.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
needs:compliance
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. "Copied to clipboard" toast disappears almost immediately on macOSUh oh!
There was an error while loading. Please reload this page. 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. | |||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |