Skip to content

Commit 5c2481a

Browse files
committed
fixed recusion on rendering
1 parent 354bf0b commit 5c2481a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React, {useState, useRef, useEffect, useReducer} from 'react' // eslint-d
55
import { FormattedMessage } from 'react-intl'
66
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'
77
import './remix-ui-tabs.css'
8+
import { values } from 'lodash'
89
const _paq = (window._paq = window._paq || [])
910

1011
/* eslint-disable-next-line */
@@ -84,8 +85,6 @@ export const TabsUI = (props: TabsUIProps) => {
8485
}
8586
}
8687

87-
getAI().then(value => setAI_switch(value)).catch(error => console.log(error))
88-
8988
const getFileDecorationClasses = (tab: any) => {
9089
const fileDecoration = tabsState.fileDecorations.find((fileDecoration: fileDecoration) => {
9190
if (`${fileDecoration.workspace.name}/${fileDecoration.path}` === tab.name) return true
@@ -101,7 +100,6 @@ export const TabsUI = (props: TabsUIProps) => {
101100
const classNameImg = 'my-1 mr-1 text-dark ' + tab.iconClass
102101
const classNameTab = 'nav-item nav-link d-flex justify-content-center align-items-center px-2 py-1 tab' + (index === currentIndexRef.current ? ' active' : '')
103102
const invert = props.themeQuality === 'dark' ? 'invert(1)' : 'invert(0)'
104-
105103
return (
106104
<CustomTooltip tooltipId="tabsActive" tooltipText={tab.tooltip} placement="bottom-start">
107105
<div
@@ -142,6 +140,7 @@ export const TabsUI = (props: TabsUIProps) => {
142140
}
143141

144142
const setFileDecorations = (fileStates: fileDecoration[]) => {
143+
getAI().then(value => setAI_switch(value)).catch(error => console.log(error))
145144
dispatch({ type: 'SET_FILE_DECORATIONS', payload: fileStates })
146145
}
147146

@@ -274,7 +273,7 @@ export const TabsUI = (props: TabsUIProps) => {
274273
data-id="remix_ai_switch"
275274
id='remix_ai_switch'
276275
className="btn ai-switch text-ai pl-2 pr-0 py-0 d-flex"
277-
disabled={!(tabsState.currentExt === 'sol' )}
276+
disabled={ !(tabsState.currentExt === 'sol' ) }
278277
onClick={async () => {
279278
await props.plugin.call('settings', 'updateCopilotChoice', !ai_switch)
280279
setAI_switch(!ai_switch)

0 commit comments

Comments
 (0)