shuqi7 commented on a change in pull request #7242: [Console] Add compaction 
dialog in druid console which allows users to add/edit data source compaction 
configuration
URL: https://github.com/apache/incubator-druid/pull/7242#discussion_r265870270
 
 

 ##########
 File path: web-console/src/components/filler.tsx
 ##########
 @@ -257,3 +259,63 @@ export class TagInput extends 
React.Component<TagInputProps, { stringValue: stri
     />;
   }
 }
+
+interface JSONInputProps extends React.Props<any>{
+  onChange: (newValue: string) => void;
+  value: JSON;
+  updateErrors: ((newValue: string) => void)
+}
+
+interface JSONInputState{
+  stringValue: string;
+}
+
+export class JSONInput extends React.Component<JSONInputProps, JSONInputState> 
{
+  constructor(props: JSONInputProps) {
+    super(props);
+    this.state = {
+      stringValue: ""
+    }
+  }
+
+  componentDidMount(): void {
+    const { value } = this.props;
+    const stringValue = parseJSONToString(value);
+    this.setState({
+      stringValue: stringValue
+    })
+  }
 
 Review comment:
   Currently JSON input works in this way: Take in JSON from auto-form through 
props as value, convert it to a string, and will only update the JSON data in 
auto-form when the string value entered is valid. If we use 
`getDerivedStateFromProps`, does this mean we will constantly check if value 
from props matches value from state, which may not work as expected, since we 
want to update the string value in state however we want, but only update the 
JSON value when that string value is valid?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to