mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
perf: remove unnecessary useMemo wrapping simple boolean expressions
Replace useMemo calls that wrap trivial boolean checks with plain const expressions. The memo overhead exceeds the cost of these simple permission checks and mode comparisons. Fixes #1052
This commit is contained in:
parent
553843ab06
commit
90ed853a26
5 changed files with 18 additions and 49 deletions
|
|
@ -121,9 +121,8 @@ export function ModelSelector({
|
|||
return llmUserConfigs?.find((c) => c.id === agentLlmId) ?? null;
|
||||
}, [preferences, llmGlobalConfigs, llmUserConfigs]);
|
||||
|
||||
const isLLMAutoMode = useMemo(() => {
|
||||
return currentLLMConfig && "is_auto_mode" in currentLLMConfig && currentLLMConfig.is_auto_mode;
|
||||
}, [currentLLMConfig]);
|
||||
const isLLMAutoMode =
|
||||
currentLLMConfig && "is_auto_mode" in currentLLMConfig && currentLLMConfig.is_auto_mode;
|
||||
|
||||
// ─── Image current config ───
|
||||
const currentImageConfig = useMemo(() => {
|
||||
|
|
@ -135,11 +134,8 @@ export function ModelSelector({
|
|||
return imageUserConfigs?.find((c) => c.id === id) ?? null;
|
||||
}, [preferences, imageGlobalConfigs, imageUserConfigs]);
|
||||
|
||||
const isImageAutoMode = useMemo(() => {
|
||||
return (
|
||||
currentImageConfig && "is_auto_mode" in currentImageConfig && currentImageConfig.is_auto_mode
|
||||
);
|
||||
}, [currentImageConfig]);
|
||||
const isImageAutoMode =
|
||||
currentImageConfig && "is_auto_mode" in currentImageConfig && currentImageConfig.is_auto_mode;
|
||||
|
||||
// ─── Vision current config ───
|
||||
const currentVisionConfig = useMemo(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue