Skip to content

Commit

Permalink
use constant
Browse files Browse the repository at this point in the history
  • Loading branch information
sashankaryal committed May 8, 2023
1 parent bdc0393 commit a0f20c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/packages/core/src/components/Actions/DynamicGroupAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import LoadingDots from "@fiftyone/components/src/components/Loading/LoadingDots
import * as fos from "@fiftyone/state";
import { useSetView } from "@fiftyone/state";
import MergeIcon from "@mui/icons-material/Merge";
import React, { useCallback, useMemo, useRef, useState } from "react";
import { useCallback, useMemo, useRef, useState } from "react";
import useMeasure from "react-use-measure";
import { useRecoilCallback, useRecoilValue } from "recoil";
import { useRecoilValue } from "recoil";
import styled from "styled-components";
import { ActionDiv } from "./ActionsRow";

Expand Down Expand Up @@ -71,7 +71,7 @@ export const DynamicGroupAction = () => {
setView((v) => [
...v,
{
_cls: "fiftyone.core.stages.GroupBy",
_cls: fos.GROUP_BY_VIEW_STAGE,
kwargs: [
["field_or_expr", groupBy],
["order_by", useOrdered ? orderBy : null],
Expand All @@ -82,13 +82,13 @@ export const DynamicGroupAction = () => {
],
},
]);
}, [canSubmitRequest, setView, groupBy, orderBy]);
}, [useOrdered, canSubmitRequest, setView, groupBy, orderBy]);

const onClear = useCallback(() => {
setView((v) => {
const newView = [...v];
const groupByIndex = newView.findIndex(
(stage) => stage._cls === "fiftyone.core.stages.GroupBy"
(stage) => stage._cls === fos.GROUP_BY_VIEW_STAGE
);
if (groupByIndex !== -1) {
newView.splice(groupByIndex, 1);
Expand Down

0 comments on commit a0f20c8

Please sign in to comment.