Repository navigation
Conversation
Signed-off-by: Bharadwaj <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
The try/catch/finally structure is right and the endless skeleton is fixed. One small change before merge: after a failed fetch, data stays null so the page falls into the existing notFound || !data branch and shows "Prompt not found — may have been deleted", which is misleading for a transient network error.
Suggestion: add a loadFailed state set in the catch, and render a distinct "Couldn't load this prompt" message (a Retry button re-invoking the load would be a nice touch) before the not-found branch — keeping "Prompt not found" for a successful fetch that returns nothing. #618 established this pattern on the Topics pages if you want a reference.
Signed-off-by: Bharadwaj <[email protected]>
|
Hi @gkhngyk I have made the changes please check once. |
gkhngyk
left a comment
There was a problem hiding this comment.
Exactly what was asked — the distinct error card with retry before the not-found branch, and "Prompt not found" now reserved for a successful-but-empty fetch. Thanks!
Summary
Adds error handling to the prompt detail page to prevent it from getting stuck in a loading state when
getPromptDetailfails.Changes
try/catch/finallyblock.setLoading(false)intofinallyso the loading state is always cleared, even if the request fails.toast.errorto surface fetch failures to the user.This ensures transient fetch failures no longer leave the page displaying a permanent loading skeleton.
Related issue
Closes #591
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)