uselotus / lotus

File .deepsource.toml not found in the default branch of the repository root. Please refer to the docs.

Detected the use of variables before they are defined JS-0357
Anti-pattern
Major
8 occurrences in this check
'submitSubstitution' was used before it was defined
124  };
125
126  useEffect(() => {
127    submitSubstitution();128  }, []);
129
130  // const changeCurrentPlanModal = (plan_id: string) => {
'submitSubstitution' was used before it was defined
120  };
121  const closeplanNewModal = () => {
122    setNewPlanVisible(false);
123    submitSubstitution();124  };
125
126  useEffect(() => {
'submitSubstitution' was used before it was defined
112  };
113  const closeplanCurrentModal = () => {
114    setReplacePlanVisible(false);
115    submitSubstitution();116  };
117
118  const openplanNewModal = () => {
'submitSubstitution' was used before it was defined
 86  const runBacktest = () => {
 87    var singlesubscription: Substitution[];
 88    if (currentPlan && replacementPlan) {
 89      submitSubstitution(); 90    } else if (substitutions.length === 0) {
 91      toast.error("Please select a few plans");
 92      return null;
 65      return;
 66    }
 67    const data: CreatePlanExternalLinkType = {
 68      plan_id: plan.plan_id, 69      source: "stripe",
 70      external_plan_id: link,
 71    };
 59
 60  const createPlanExternalLink = (link: string) => {
 61    if (plan.external_links.find((links) => links.external_plan_id === link)) {
 62      toast.error(`Duplicate  external link for ${plan.plan_name}`, { 63        position: toast.POSITION.TOP_CENTER,
 64      });
 65      return;
 58  );
 59
 60  const createPlanExternalLink = (link: string) => {
 61    if (plan.external_links.find((links) => links.external_plan_id === link)) { 62      toast.error(`Duplicate  external link for ${plan.plan_name}`, {
 63        position: toast.POSITION.TOP_CENTER,
 64      });
'changeMetric' was used before it was defined
 38    if (data?.metrics && Object.keys(data.metrics).length > 0) {
 39      setMetricList(Object.keys(data.metrics));
 40      setSelectedMetric(Object.keys(data.metrics)[0]);
 41      changeMetric(Object.keys(data.metrics)[0]); 42    }
 43  }, [data]);
 44