[Chore/Refactor] Implement lazy initialization for useState calls to prevent re-computation (#26252)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: asukaminato0721 <30024051+asukaminato0721@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@ const TabSlider: FC<TabSliderProps> = ({
|
||||
onChange,
|
||||
options,
|
||||
}) => {
|
||||
const [activeIndex, setActiveIndex] = useState(options.findIndex(option => option.value === value))
|
||||
const [activeIndex, setActiveIndex] = useState(() => options.findIndex(option => option.value === value))
|
||||
const [sliderStyle, setSliderStyle] = useState({})
|
||||
const { data: pluginList } = useInstalledPluginList()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user