File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
Expand file tree Collapse file tree 1 file changed +8
-16
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments