-
Notifications
You must be signed in to change notification settings - Fork 9
fix: Start Over button now properly resets state to allow new generations #65
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 1 commit
89186f8
e56b852
7554da9
3529178
e16c34f
8e58537
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 |
|---|---|---|
|
|
@@ -849,6 +849,17 @@ export default function Home() { | |
| setBlobUrls([]); | ||
| }; | ||
|
|
||
| // Start over: clear results and go back to step 1 | ||
| const handleStartOver = () => { | ||
| cleanupBlobUrls(); | ||
| setResults([]); | ||
| setLabeledResults([]); | ||
| setSuggestedRefinements({}); | ||
| setLoadingSuggestions({}); | ||
| setError(null); | ||
| goTo(1); | ||
|
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.
🤖 Was this useful? React with 👍 or 👎 |
||
| }; | ||
|
|
||
| const generate = async () => { | ||
| // Get all valid template IDs (custom + curated) | ||
| const allValidTemplateIds = new Set([ | ||
|
|
@@ -2125,7 +2136,7 @@ export default function Home() { | |
|
|
||
| {/* Compact nav */} | ||
| <div className={styles.navRow} style={{ marginTop: 12 }}> | ||
| <button onClick={() => goTo(1)} style={{ padding: '6px 12px', fontSize: 13 }}>← Start Over</button> | ||
| <button onClick={handleStartOver} style={{ padding: '6px 12px', fontSize: 13 }}>← Start Over</button> | ||
| </div> | ||
| </> | ||
| )} | ||
|
|
||
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.
If “Start Over” can be clicked while generation or suggested-refinement fetches are still in flight, those async completions can still update
results/suggestedRefinements(index-keyed) after this reset, potentially causing stale suggestions or a stuckloadingstate. Consider adding a guard/cancellation mechanism for outstanding async work when starting over.🤖 Was this useful? React with 👍 or 👎