Skip to content

Commit

Permalink
remove unused loading text for tags (#2948)
Browse files Browse the repository at this point in the history
Co-authored-by: brimoor <[email protected]>
  • Loading branch information
benjaminpkane and brimoor committed May 9, 2023
1 parent 7146414 commit 96edd9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 51 deletions.
19 changes: 7 additions & 12 deletions app/packages/core/src/components/SamplesContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as fos from "@fiftyone/state";
import { Controller } from "@react-spring/web";
import React, { useCallback } from "react";
import { useRecoilValue } from "recoil";
import { Controller } from "@react-spring/web";
import styled from "styled-components";
import Sidebar, { Entries } from "./Sidebar";
import * as fos from "@fiftyone/state";
import MainSpace from "./MainSpace";
import Sidebar, { Entries } from "./Sidebar";

const Container = styled.div`
display: flex;
Expand Down Expand Up @@ -82,15 +82,10 @@ function SamplesContainer() {
return {
children: (
<Entries.Empty
useText={
group === "tags"
? () => fos.useTagText(false)
: group === "label tags"
? () => fos.useLabelTagText(false)
: () => ({
text: "No fields",
})
}
useText={() => ({
text: "No fields",
loading: false,
})}
key={key}
/>
),
Expand Down
53 changes: 14 additions & 39 deletions app/packages/state/src/recoil/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import {
atomFamily,
DefaultValue,
selector,
selectorFamily,
useRecoilStateLoadable,
useRecoilValue,
useRecoilValueLoadable,
} from "recoil";
import { setSidebarGroups, setSidebarGroupsMutation } from "@fiftyone/relay";
import {
DICT_FIELD,
DYNAMIC_EMBEDDED_DOCUMENT_FIELD,
EMBEDDED_DOCUMENT_FIELD,
LABELS_PATH,
LABEL_DOC_TYPES,
Expand All @@ -20,27 +11,31 @@ import {
VALID_PRIMITIVE_TYPES,
withPath,
} from "@fiftyone/utilities";

import { VariablesOf, commitMutation } from "react-relay";
import {
DefaultValue,
atomFamily,
selector,
selectorFamily,
useRecoilStateLoadable,
useRecoilValue,
} from "recoil";
import { getCurrentEnvironment } from "../hooks/useRouter";
import * as aggregationAtoms from "./aggregations";
import { dataset } from "./atoms";
import { isLargeVideo } from "./options";
import {
buildFlatExtendedSchema,
buildSchema,
field,
fieldPaths,
fields,
filterPaths,
pathIsShown,
schemaReduce,
} from "./schema";

import { datasetName, isVideoDataset, stateSubscription } from "./selectors";
import { State } from "./types";
import * as viewAtoms from "./view";
import { datasetName, isVideoDataset, stateSubscription } from "./selectors";
import { isLargeVideo } from "./options";
import { commitMutation, VariablesOf } from "react-relay";
import { setSidebarGroups, setSidebarGroupsMutation } from "@fiftyone/relay";
import { getCurrentEnvironment } from "../hooks/useRouter";
import { dataset, dataset } from "./atoms";

export enum EntryKind {
EMPTY = "EMPTY",
Expand Down Expand Up @@ -97,26 +92,6 @@ export const readableTags = selectorFamily<
},
});

export const useLabelTagText = (modal: boolean) => {
const loading =
useRecoilValueLoadable(readableTags({ modal, group: "label tags" }))
.state === "loading";

return { text: loading ? "Loading label tags" : "No label tags", loading };
};

export const useTagText = (modal: boolean) => {
const { singular } = useRecoilValue(viewAtoms.elementNames);
const loading =
useRecoilValueLoadable(readableTags({ modal, group: "tags" })).state ===
"loading";

return {
text: loading ? `Loading ${singular} tags` : `No ${singular} tags`,
loading,
};
};

export const useEntries = (
modal: boolean
): [SidebarEntry[], (entries: SidebarEntry[]) => void] => {
Expand Down

0 comments on commit 96edd9e

Please sign in to comment.