Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/components/JsonSchemaViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
import { Box, Provider as MosaicProvider } from '@stoplight/mosaic';
import { ErrorBoundaryForwardedProps, FallbackProps, withErrorBoundary } from '@stoplight/react-error-boundary';
import cn from 'classnames';
import { Provider } from 'jotai';
import { useUpdateAtom } from 'jotai/utils';
import { Provider, useSetAtom } from 'jotai';
import * as React from 'react';

import { JSVOptions, JSVOptionsContextProvider } from '../contexts';
Expand Down Expand Up @@ -104,7 +103,7 @@ const JsonSchemaViewerInner = ({
| 'parentCrumbs'
| 'skipTopLevelDescription'
>) => {
const setHoveredNode = useUpdateAtom(hoveredNodeAtom);
const setHoveredNode = useSetAtom(hoveredNodeAtom);
const onMouseLeave = React.useCallback(() => {
setHoveredNode(null);
}, [setHoveredNode]);
Expand Down
5 changes: 2 additions & 3 deletions src/components/SchemaRow/SchemaRow.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { isMirroredNode, isReferenceNode, isRegularNode, SchemaNode } from '@stoplight/json-schema-tree';
import { Box, Flex, NodeAnnotation, Select, SpaceVals, VStack } from '@stoplight/mosaic';
import type { ChangeType } from '@stoplight/types';
import { Atom } from 'jotai';
import { useAtomValue, useUpdateAtom } from 'jotai/utils';
import { Atom, useAtomValue, useSetAtom } from 'jotai';
import last from 'lodash/last.js';
import * as React from 'react';

Expand Down Expand Up @@ -39,7 +38,7 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = React.memo(
viewMode,
} = useJSVOptionsContext();

const setHoveredNode = useUpdateAtom(hoveredNodeAtom);
const setHoveredNode = useSetAtom(hoveredNodeAtom);

const nodeId = getNodeId(schemaNode, parentNodeId);

Expand Down
4 changes: 2 additions & 2 deletions src/components/SchemaRow/TopLevelSchemaRow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isPlainObject } from '@stoplight/json';
import { isRegularNode, RegularNode } from '@stoplight/json-schema-tree';
import { Box, Flex, HStack, Icon, Menu, Pressable } from '@stoplight/mosaic';
import { useUpdateAtom } from 'jotai/utils';
import { useSetAtom } from 'jotai';
import { isEmpty } from 'lodash';
import * as React from 'react';

Expand Down Expand Up @@ -152,7 +152,7 @@ function ScrollCheck() {
const elementRef = React.useRef<HTMLDivElement>(null);

const isOnScreen = useIsOnScreen(elementRef);
const setShowPathCrumbs = useUpdateAtom(showPathCrumbsAtom);
const setShowPathCrumbs = useSetAtom(showPathCrumbsAtom);
React.useEffect(() => {
setShowPathCrumbs(!isOnScreen);
}, [isOnScreen, setShowPathCrumbs]);
Expand Down