-
Notifications
You must be signed in to change notification settings - Fork 280
feat: update delete cell confirmation popup #1179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import React, { useEffect, useState } from 'react'; | ||
|
|
||
| import { IDataCell } from 'const/datadoc'; | ||
| import { ThemedCodeHighlightWithMark } from 'ui/CodeHighlight/ThemedCodeHighlightWithMark'; | ||
|
|
||
| interface IProps { | ||
| cell: IDataCell; | ||
| } | ||
|
|
||
| export const DataDocDeletePreview: React.FunctionComponent<IProps> = ({ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably don't need another component for this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Responding to this and the previous comment, the separate component was added because without it CodeMirror wouldn't show the query contents when the delete confirmation first loaded. The fix we found was to force it to rerender by changing the state variable with useEffect, which isn't possible without a separate component. |
||
| cell, | ||
| }) => { | ||
| const [query, setQuery] = useState<string>(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you need query as a state? vs |
||
|
|
||
| useEffect(() => { | ||
| setQuery(cell.context as string); | ||
| }, [cell.context]); | ||
|
|
||
| return ( | ||
| <div> | ||
| <span>Deleted cells cannot be recovered</span> | ||
| {cell.cell_type === 'query' && query !== '' && ( | ||
| <ThemedCodeHighlightWithMark | ||
| query={query} | ||
| maxEditorHeight="20vh" | ||
| autoHeight={false} | ||
| /> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part is same as
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Structured this part in this way to avoid the below linting error.