Skip to content

Commit b4974f4

Browse files
committed
feat: add react-router-dom dependency and maintain text prompt persistence per label
- Install missing react-router-dom package for routing support - Implement per-label text prompt persistence in localStorage - Auto-load saved prompts when switching labels - Save prompts after successful inference runs - Prompts persist across image navigation within session
1 parent ab8050e commit b4974f4

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed

apps/web/package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"react-dom": "^19.2.0",
2323
"react-hot-toast": "^2.6.0",
2424
"react-konva": "^19.2.1",
25-
"react-router-dom": "^6.30.2",
25+
"react-router-dom": "^6.30.3",
2626
"tailwind-merge": "^3.4.0"
2727
},
2828
"devDependencies": {

apps/web/src/components/TextPromptPanel.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,19 @@ export function TextPromptPanel({
8787
if (labelId) {
8888
const savedPrompt = labelPrompts[labelId] || ''
8989
setTextPrompt(savedPrompt)
90-
console.log(`[TextPrompt] Loaded saved prompt for label ${labelId}:`, savedPrompt)
9190
}
92-
}, [labelId, labelPrompts]) // Load when label ID changes or prompts update
91+
}, [labelId]) // Load when label ID changes
9392

9493
// Notify parent of text prompt changes for indicator display
9594
useEffect(() => {
9695
onTextPromptChange?.(textPrompt)
9796
}, [textPrompt, onTextPromptChange])
9897

99-
// Save text prompt for current label to localStorage whenever it changes
100-
useEffect(() => {
101-
if (labelId && textPrompt) {
102-
const updated = { ...labelPrompts, [labelId]: textPrompt }
103-
setLabelPrompts(updated)
104-
localStorage.setItem('labelTextPrompts', JSON.stringify(updated))
105-
console.log(`[TextPrompt] Auto-saved prompt for label ${labelId}:`, textPrompt)
106-
}
107-
}, [textPrompt, labelId])
108-
109-
// Save text prompt for current label to localStorage (manual save)
98+
// Save text prompt for current label to localStorage
11099
const savePromptForLabel = (labelIdToSave: string, prompt: string) => {
111100
const updated = { ...labelPrompts, [labelIdToSave]: prompt }
112101
setLabelPrompts(updated)
113102
localStorage.setItem('labelTextPrompts', JSON.stringify(updated))
114-
console.log(`[TextPrompt] Manually saved prompt for label ${labelIdToSave}:`, prompt)
115103
}
116104

117105
// Reset auto-apply state only when switching away from auto-apply mode

0 commit comments

Comments
 (0)