Skip to content

Commit

Permalink
fix: Do not measure the container height when resetting table view
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Sep 20, 2022
1 parent e916e20 commit 348b5d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/chart-footnotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const ChartFootnotes = ({
const classes = useStyles();
const locale = useLocale();
const [shareUrl, setShareUrl] = useState("");
const { state: isTablePreview, setState: setIsTablePreview } =
const { state: isTablePreview, setStateRaw: setIsTablePreview } =
useChartTablePreview();
// Reset back to chart view when switching chart type.
useEffect(() => {
Expand Down
5 changes: 4 additions & 1 deletion app/components/chart-table-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ import {
type Context = {
state: boolean;
setState: Dispatch<SetStateAction<boolean>>;
setStateRaw: Dispatch<SetStateAction<boolean>>;
containerRef: RefObject<HTMLDivElement>;
containerHeight: RefObject<"auto" | number>;
};

const ChartTablePreviewContext = createContext<Context>({
state: true,
setState: () => {},
setStateRaw: () => {},
containerRef: { current: null },
containerHeight: { current: "auto" },
});
Expand Down Expand Up @@ -66,10 +68,11 @@ export const ChartTablePreviewProvider = ({
return {
state,
setState,
setStateRaw,
containerRef,
containerHeight,
};
}, [setState, state]);
}, [setState, state, containerRef, containerHeight, setStateRaw]);
return (
<ChartTablePreviewContext.Provider value={ctx}>
{children}
Expand Down

1 comment on commit 348b5d4

@vercel
Copy link

@vercel vercel bot commented on 348b5d4 Sep 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-ixt1.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-alpha.vercel.app

Please sign in to comment.