some comments
This commit is contained in:
parent
d2fb973e1d
commit
9385146d56
|
@ -328,6 +328,8 @@ export const SquigglePlayground: FC<PlaygroundProps> = ({
|
|||
<StyledTab.Panel>
|
||||
<ViewSettings
|
||||
register={
|
||||
// This is dangerous, but doesn't cause any problems.
|
||||
// I tried to make `ViewSettings` generic (to allow it to accept any extension of a settings schema), but it didn't work.
|
||||
register as unknown as UseFormRegister<
|
||||
yup.InferType<typeof viewSettingsSchema>
|
||||
>
|
||||
|
|
|
@ -33,6 +33,7 @@ const ItemSettingsModal: React.FC<Props & { close: () => void }> = ({
|
|||
const { register, watch } = useForm({
|
||||
resolver: yupResolver(viewSettingsSchema),
|
||||
defaultValues: {
|
||||
// this is a mess and should be fixed
|
||||
showEditor: true, // doesn't matter
|
||||
chartHeight: mergedSettings.height,
|
||||
showSummary: mergedSettings.distributionPlotSettings.showSummary,
|
||||
|
|
|
@ -22,6 +22,9 @@ export const VariableBox: React.FC<VariableBoxProps> = ({
|
|||
}) => {
|
||||
const { setSettings, getSettings, getMergedSettings } =
|
||||
useContext(ViewerContext);
|
||||
|
||||
// Since ViewerContext doesn't keep the actual settings, VariableBox won't rerender when setSettings is called.
|
||||
// So we use `forceUpdate` to force rerendering.
|
||||
const [_, forceUpdate] = useReducer((x) => x + 1, 0);
|
||||
|
||||
const settings = getSettings(path);
|
||||
|
|
Loading…
Reference in New Issue
Block a user