mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-08 03:07:53 +00:00
Merge pull request #1097 from System233/patch-setting-done
Fix settings done button with unsaved changes
This commit is contained in:
commit
259c2195e2
3 changed files with 10 additions and 21 deletions
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Fix settings done button with unsaved changes
|
||||
|
|
@ -28,16 +28,13 @@ const App = () => {
|
|||
const [tab, setTab] = useState<Tab>("chat")
|
||||
const settingsRef = useRef<SettingsViewRef>(null)
|
||||
|
||||
const switchTab = useCallback(
|
||||
(newTab: Tab) => {
|
||||
if (tab === "settings" && settingsRef.current?.checkUnsaveChanges) {
|
||||
settingsRef.current.checkUnsaveChanges(() => setTab(newTab))
|
||||
} else {
|
||||
setTab(newTab)
|
||||
}
|
||||
},
|
||||
[tab],
|
||||
)
|
||||
const switchTab = useCallback((newTab: Tab) => {
|
||||
if (settingsRef.current?.checkUnsaveChanges) {
|
||||
settingsRef.current.checkUnsaveChanges(() => setTab(newTab))
|
||||
} else {
|
||||
setTab(newTab)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const onMessage = useCallback(
|
||||
(e: MessageEvent) => {
|
||||
|
|
@ -73,7 +70,7 @@ const App = () => {
|
|||
<WelcomeView />
|
||||
) : (
|
||||
<>
|
||||
{tab === "settings" && <SettingsView ref={settingsRef} onDone={() => switchTab("chat")} />}
|
||||
{tab === "settings" && <SettingsView ref={settingsRef} onDone={() => setTab("chat")} />}
|
||||
{tab === "history" && <HistoryView onDone={() => switchTab("chat")} />}
|
||||
{tab === "mcp" && <McpView onDone={() => switchTab("chat")} />}
|
||||
{tab === "prompts" && <PromptsView onDone={() => switchTab("chat")} />}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone },
|
|||
text: currentApiConfigName,
|
||||
apiConfiguration,
|
||||
})
|
||||
// onDone()
|
||||
setChangeDetected(false)
|
||||
}
|
||||
}
|
||||
|
|
@ -216,11 +217,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone },
|
|||
|
||||
const onConfirmDialogResult = useCallback((confirm: boolean) => {
|
||||
if (confirm) {
|
||||
setChangeDetected(false)
|
||||
// Wait for the change detection to be updated
|
||||
setTimeout(() => {
|
||||
confirmDialogHandler.current?.()
|
||||
}, 100)
|
||||
confirmDialogHandler.current?.()
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue