Skip to content

Commit d8bc6a6

Browse files
committed
fix: Remove unncessary url changes and hasText from appcontext
1 parent 1c3deb9 commit d8bc6a6

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

pages/prompt-input/simple.page.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type DemoContext = React.Context<
2929
isReadOnly: boolean;
3030
isInvalid: boolean;
3131
hasWarning: boolean;
32-
hasText: boolean;
3332
hasSecondaryContent: boolean;
3433
hasSecondaryActions: boolean;
3534
hasPrimaryActions: boolean;
@@ -51,7 +50,6 @@ export default function PromptInputPage() {
5150
isReadOnly,
5251
isInvalid,
5352
hasWarning,
54-
hasText,
5553
hasSecondaryActions,
5654
hasSecondaryContent,
5755
hasPrimaryActions,
@@ -64,19 +62,6 @@ export default function PromptInputPage() {
6462
{ label: 'Item 3', dismissLabel: 'Remove item 3', disabled: isDisabled },
6563
]);
6664

67-
useEffect(() => {
68-
if (hasText) {
69-
setTextareaValue(placeholderText);
70-
}
71-
}, [hasText]);
72-
73-
useEffect(() => {
74-
if (hasText && textareaValue !== placeholderText) {
75-
setUrlParams({ hasText: false });
76-
}
77-
// eslint-disable-next-line react-hooks/exhaustive-deps
78-
}, [textareaValue]);
79-
8065
useEffect(() => {
8166
if (items.length === 0) {
8267
ref.current?.focus();
@@ -165,7 +150,14 @@ export default function PromptInputPage() {
165150
Infinite max rows
166151
</Checkbox>
167152
</FormField>
168-
<button id="placeholder-text-button" onClick={() => setUrlParams({ hasText: true })}>
153+
<button
154+
id="placeholder-text-button"
155+
onClick={() => {
156+
if (textareaValue === '') {
157+
setTextareaValue(placeholderText);
158+
}
159+
}}
160+
>
169161
Fill with placeholder text
170162
</button>
171163

0 commit comments

Comments
 (0)