mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-28 00:16:55 +00:00
take out toggle button when closing tab
This commit is contained in:
parent
0566f19e87
commit
44667beba9
@ -66,6 +66,15 @@ export const QueryCopilotTab: React.FC<QueryCopilotProps> = ({ explorer }: Query
|
|||||||
useCommandBar.getState().setContextButtons(getCommandbarButtons());
|
useCommandBar.getState().setContextButtons(getCommandbarButtons());
|
||||||
}, [query, selectedQuery, copilotActive]);
|
}, [query, selectedQuery, copilotActive]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
const commandbarButtons = getCommandbarButtons();
|
||||||
|
commandbarButtons.pop();
|
||||||
|
commandbarButtons.map((props: CommandButtonComponentProps) => (props.disabled = true));
|
||||||
|
useCommandBar.getState().setContextButtons(commandbarButtons);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
const toggleCopilot = (toggle: boolean) => {
|
const toggleCopilot = (toggle: boolean) => {
|
||||||
setCopilotActive(toggle);
|
setCopilotActive(toggle);
|
||||||
localStorage.setItem(`${userContext.databaseAccount?.id}-queryCopilotToggleStatus`, toggle.toString());
|
localStorage.setItem(`${userContext.databaseAccount?.id}-queryCopilotToggleStatus`, toggle.toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user