diff --git a/src/data-types.tsx b/src/data-types.tsx index b020469..3eb2877 100644 --- a/src/data-types.tsx +++ b/src/data-types.tsx @@ -9,7 +9,7 @@ import * as Y from "yjs"; import { Badge } from "./components/ui/badge"; import { toast } from "./components/ui/use-toast"; import { removeMismatchedValues } from "./filter-set"; -import { useConfig, useFilterSet } from "./state"; +import { useConfig, useFilterSet, useIsFilterEnable } from "./state"; import { getYTypeName, isYShape, parseYShape } from "./y-shape"; const TypeLabel = ({ value }: { value: unknown }) => { @@ -85,7 +85,8 @@ const YTypeComponent: ComponentType> = ({ const StrComponent = stringType.Component!; const ObjComponent = objectType.Component!; const [config] = useConfig(); - const [filterSet] = useFilterSet(); + const filterSet = useFilterSet(); + const isFilterEnable = useIsFilterEnable(); if (!config.parseYDoc) { if (typeof value === "string") { @@ -116,7 +117,9 @@ const YTypeComponent: ComponentType> = ({ ); } - const filteredValue = removeMismatchedValues(parsedValue, filterSet); + const filteredValue = isFilterEnable + ? removeMismatchedValues(parsedValue, filterSet) + : parsedValue; if (!filteredValue) { return null; }