Skip to content

Commit ea5d0b8

Browse files
committed
AI copilot sync fixed
1 parent 52e6c57 commit ea5d0b8

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

libs/remix-ui/statusbar/src/lib/components/aiStatus.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ interface AIStatusProps {
1414
export default function AIStatus(props: AIStatusProps) {
1515
const [copilotActive, setCopilotActive] = useState(false)
1616
const appContext = useContext(AppContext)
17+
1718
useEffect(() => {
18-
1919
const run = async () => {
2020
const aiActivate = await props.plugin.call('settings', 'get', 'settings/copilot/suggest/activate')
2121
setCopilotActive(aiActivate)
@@ -33,7 +33,7 @@ export default function AIStatus(props: AIStatusProps) {
3333
}, 5000);
3434

3535
return () => clearTimeout(timer);
36-
}, []);
36+
}, [])
3737

3838
useEffect(() => {
3939
const run = async () => {
@@ -43,7 +43,7 @@ export default function AIStatus(props: AIStatusProps) {
4343
})
4444
}
4545
run()
46-
}, [props.plugin.isAiActive, props.plugin.isAiActive])
46+
}, [props.plugin.isAiActive, props.isAiActive])
4747

4848
return (
4949
<div>

libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ export const TabsUI = (props: TabsUIProps) => {
8686
})
8787
}
8888
}, [tabsState.selectedIndex])
89+
// Toggle the copilot in editor when clicked to update in status bar
90+
useEffect(() => {
91+
const run = async () => {
92+
props.plugin.on('settings', 'copilotChoiceUpdated', async (isChecked) => {
93+
setAI_switch(isChecked)
94+
})
95+
}
96+
if (tabsState.currentExt === 'sol') run()
97+
}, [tabsState.currentExt])
8998

9099
const getAI = async () => {
91100
try {

0 commit comments

Comments
 (0)