eschutho commented on a change in pull request #12341:
URL: https://github.com/apache/superset/pull/12341#discussion_r585180019
##########
File path: superset-frontend/src/views/CRUD/annotation/AnnotationModal.tsx
##########
@@ -206,32 +225,38 @@ const AnnotationModal:
FunctionComponent<AnnotationModalProps> = ({
};
// Initialize
- if (
- isEditMode &&
- (!currentAnnotation ||
- !currentAnnotation.id ||
- (annotation && annotation.id !== currentAnnotation.id) ||
- (isHidden && show))
- ) {
- if (annotation && annotation.id !== null && !loading) {
- const id = annotation.id || 0;
-
- fetchResource(id).then(() => {
- setCurrentAnnotation(resource);
+ useEffect(() => {
+ if (
+ isEditMode &&
+ (!currentAnnotation ||
+ !currentAnnotation.id ||
+ (annotation && annotation.id !== currentAnnotation.id) ||
+ (isHidden && show))
+ ) {
Review comment:
you can also use optional chaining to help if you want.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]