Skip to content

Commit 26971c9

Browse files
committed
pass initialValue instead of defaultvalue
1 parent 0f5f7bf commit 26971c9

4 files changed

Lines changed: 40 additions & 40 deletions

File tree

apps/roam/src/components/settings/DiscourseNodeCanvasSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const DiscourseNodeCanvasSettings = ({ nodeType, uid }: { nodeType: string; uid:
9797
title="Key Image"
9898
description="Add an image to the discourse node"
9999
settingKeys={["canvasSettings", "key-image"]}
100-
defaultValue={isKeyImage}
100+
initialValue={isKeyImage}
101101
onChange={(checked) => {
102102
setIsKeyImage(checked);
103103
if (checked && !keyImageOption) setKeyImageOption("first-image");

apps/roam/src/components/settings/DiscourseNodeSuggestiveRules.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const DiscourseNodeSuggestiveRules = ({
9696
title="Embedding Block Ref"
9797
description="Copy block ref from template which you want to be embedded and ranked."
9898
settingKeys={["suggestiveRules", "embeddingRef"]}
99-
defaultValue={node.embeddingRef || ""}
99+
initialValue={node.embeddingRef || ""}
100100
placeholder="((block-uid))"
101101
onChange={setEmbeddingRef}
102102
order={1}
@@ -116,7 +116,7 @@ const DiscourseNodeSuggestiveRules = ({
116116
title="First Child"
117117
description="If the block is the first child of the embedding block ref, it will be embedded and ranked."
118118
settingKeys={["suggestiveRules", "isFirstChild"]}
119-
defaultValue={node.isFirstChild?.value || false}
119+
initialValue={node.isFirstChild?.value || false}
120120
order={2}
121121
uid={node.isFirstChild?.uid || ""}
122122
parentUid={parentUid}

apps/roam/src/components/settings/NodeConfig.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ const NodeConfig = ({
262262
title="Description"
263263
description={`Describing what the ${node.text} node represents in your graph.`}
264264
settingKeys={["description"]}
265-
defaultValue={node.description}
265+
initialValue={node.description}
266266
order={1}
267267
parentUid={node.type}
268268
uid={descriptionUid}
@@ -272,7 +272,7 @@ const NodeConfig = ({
272272
title="Shortcut"
273273
description={`The trigger to quickly create a ${node.text} page from the node menu.`}
274274
settingKeys={["shortcut"]}
275-
defaultValue={node.shortcut}
275+
initialValue={node.shortcut}
276276
order={0}
277277
parentUid={node.type}
278278
uid={shortcutUid}
@@ -282,7 +282,7 @@ const NodeConfig = ({
282282
title="Tag"
283283
description={`Designate a hashtag for marking potential ${node.text}.`}
284284
settingKeys={["tag"]}
285-
defaultValue={node.tag}
285+
initialValue={node.tag}
286286
placeholder={generateTagPlaceholder(node)}
287287
getValidationError={validateTag}
288288
onChange={setTagValue}
@@ -390,7 +390,7 @@ const NodeConfig = ({
390390
title="Graph Overview"
391391
description="Whether to color the node in the graph overview based on canvas color. This is based on the node's plain title as described by a `has title` condition in its specification."
392392
settingKeys={["graphOverview"]}
393-
defaultValue={node.graphOverview}
393+
initialValue={node.graphOverview}
394394
order={0}
395395
parentUid={node.type}
396396
uid={graphOverviewUid}

apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import React, { type ChangeEvent, useState, useCallback, useRef, useEffect } from "react";
1+
import React, {
2+
type ChangeEvent,
3+
useState,
4+
useCallback,
5+
useRef,
6+
useEffect,
7+
} from "react";
28
import {
39
Checkbox,
410
InputGroup,
@@ -15,7 +21,6 @@ import {
1521
setGlobalSetting,
1622
setPersonalSetting,
1723
setFeatureFlag,
18-
getDiscourseNodeSetting,
1924
setDiscourseNodeSetting,
2025
} from "../utils/accessors";
2126
import type { FeatureFlags } from "../utils/zodSchema";
@@ -138,7 +143,6 @@ const BaseTextPanel = ({
138143
};
139144

140145
return (
141-
142146
<div className="flex flex-col">
143147
<Label>
144148
{title}
@@ -576,49 +580,45 @@ type DiscourseNodeBaseProps = {
576580
export const DiscourseNodeTextPanel = ({
577581
nodeType,
578582
...props
579-
}: DiscourseNodeBaseProps & RoamBlockSyncProps & {
580-
defaultValue?: string;
581-
placeholder?: string;
582-
getValidationError?: Validator<string>;
583-
onChange?: (value: string) => void;
584-
}) => (
585-
<BaseTextPanel
586-
{...props}
587-
setter={createDiscourseNodeSetter(nodeType)}
588-
/>
583+
}: DiscourseNodeBaseProps &
584+
RoamBlockSyncProps & {
585+
initialValue?: string;
586+
placeholder?: string;
587+
getValidationError?: Validator<string>;
588+
onChange?: (value: string) => void;
589+
}) => (
590+
<BaseTextPanel {...props} setter={createDiscourseNodeSetter(nodeType)} />
589591
);
590592

591593
export const DiscourseNodeFlagPanel = ({
592594
nodeType,
593595
...props
594-
}: DiscourseNodeBaseProps & RoamBlockSyncProps & {
595-
defaultValue?: boolean;
596-
disabled?: boolean;
597-
onBeforeChange?: (checked: boolean) => Promise<boolean>;
598-
onChange?: (checked: boolean) => void;
599-
}) => (
600-
<BaseFlagPanel
601-
{...props}
602-
setter={createDiscourseNodeSetter(nodeType)}
603-
/>
596+
}: DiscourseNodeBaseProps &
597+
RoamBlockSyncProps & {
598+
initialValue?: boolean;
599+
disabled?: boolean;
600+
onBeforeChange?: (checked: boolean) => Promise<boolean>;
601+
onChange?: (checked: boolean) => void;
602+
}) => (
603+
<BaseFlagPanel {...props} setter={createDiscourseNodeSetter(nodeType)} />
604604
);
605605

606606
export const DiscourseNodeSelectPanel = ({
607607
nodeType,
608608
...props
609-
}: DiscourseNodeBaseProps & RoamBlockSyncProps & { options: string[]; defaultValue?: string }) => (
610-
<BaseSelectPanel
611-
{...props}
612-
setter={createDiscourseNodeSetter(nodeType)}
613-
/>
609+
}: DiscourseNodeBaseProps &
610+
RoamBlockSyncProps & { options: string[]; initialValue?: string }) => (
611+
<BaseSelectPanel {...props} setter={createDiscourseNodeSetter(nodeType)} />
614612
);
615613

616614
export const DiscourseNodeNumberPanel = ({
617615
nodeType,
618616
...props
619-
}: DiscourseNodeBaseProps & RoamBlockSyncProps & { defaultValue?: number; min?: number; max?: number }) => (
620-
<BaseNumberPanel
621-
{...props}
622-
setter={createDiscourseNodeSetter(nodeType)}
623-
/>
617+
}: DiscourseNodeBaseProps &
618+
RoamBlockSyncProps & {
619+
initialValue?: number;
620+
min?: number;
621+
max?: number;
622+
}) => (
623+
<BaseNumberPanel {...props} setter={createDiscourseNodeSetter(nodeType)} />
624624
);

0 commit comments

Comments
 (0)