Skip to content

Commit

Permalink
Code optimization in declaring variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tahierhussain committed Jan 30, 2025
1 parent 5cd5ddc commit 244a9a6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions frontend/src/components/input-output/add-source/AddSource.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";

import { sourceTypes } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
Expand Down Expand Up @@ -49,7 +49,6 @@ function AddSource({
const { setAlertDetails } = useAlertStore();
const axiosPrivate = useAxiosPrivate();
const handleException = useExceptionHandler();
const [isLLMWPaidSchema, setIsLLMWPaidSchema] = useState(false);

let transformLlmWhispererFormData;
try {
Expand All @@ -67,13 +66,13 @@ function AddSource({
);
}

useEffect(() => {
setIsLLMWPaidSchema(
const isLLMWPaidSchema = useMemo(() => {
return (
LLMW_V2_ID &&
transformLlmWhispererJsonSchema &&
PLAN_TYPES &&
selectedSourceId === LLMW_V2_ID &&
planType === PLAN_TYPES?.PAID
transformLlmWhispererJsonSchema &&
PLAN_TYPES &&
selectedSourceId === LLMW_V2_ID &&
planType === PLAN_TYPES?.PAID
);
}, [
LLMW_V2_ID,
Expand Down

0 comments on commit 244a9a6

Please sign in to comment.