File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const App = () => {
4545 cloudIsAuthenticated,
4646 cloudApiUrl,
4747 renderContext,
48+ mdmCompliant,
4849 } = useExtensionState ( )
4950
5051 // Create a persistent state manager
@@ -66,15 +67,23 @@ const App = () => {
6667 const settingsRef = useRef < SettingsViewRef > ( null )
6768 const chatViewRef = useRef < ChatViewRef > ( null )
6869
69- const switchTab = useCallback ( ( newTab : Tab ) => {
70- setCurrentSection ( undefined )
70+ const switchTab = useCallback (
71+ ( newTab : Tab ) => {
72+ // Check MDM compliance before allowing tab switching
73+ if ( mdmCompliant === false && newTab !== "account" ) {
74+ return
75+ }
7176
72- if ( settingsRef . current ?. checkUnsaveChanges ) {
73- settingsRef . current . checkUnsaveChanges ( ( ) => setTab ( newTab ) )
74- } else {
75- setTab ( newTab )
76- }
77- } , [ ] )
77+ setCurrentSection ( undefined )
78+
79+ if ( settingsRef . current ?. checkUnsaveChanges ) {
80+ settingsRef . current . checkUnsaveChanges ( ( ) => setTab ( newTab ) )
81+ } else {
82+ setTab ( newTab )
83+ }
84+ } ,
85+ [ mdmCompliant ] ,
86+ )
7887
7988 const [ currentSection , setCurrentSection ] = useState < string | undefined > ( undefined )
8089
You can’t perform that action at this time.
0 commit comments