Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feature/211 edit publish alert messages #217
Feature/211 edit publish alert messages #217
Changes from 9 commits
41e987c
de2fcd8
417c300
1b4edba
b5688f2
efb7fa9
74cf949
76af54e
3768758
a73310e
1487b77
be873a9
3ef0c7b
390923a
3a5d7fe
abe1188
fe434bd
ae4afc5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I was thinking of a different design
So the responsibility of DatasetAlerts is to add the alerts that are created when there is a page reload and to call the Alert component that displays all the page alerts.
But the
<Alerts></Alerts>
component doesn't expect alerts by props, instead it reads the alerts from the AlertsContextThis way if there is some action that doesn't require a page reload, the Alerts component will be updated with a new alert but without overriding the initial alerts. That's the cool thing about the context, it can update a state from wherever without the need of props
Additionally I did some renaming so the alerts are general alerts instead of dataset alerts so we can reuse the context and the component in future pages
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.
Ok, I see what you mean, that makes sense. I had to add some code to make sure that the same alert isn't added multiple times, because it seems that the render of DatasetAlerts.tsx is called multiple times when the page is loaded.
I agree about making DatasetAlert more general - I renamed the DatasetAlert type and moved it to it's own file, Alert.ts. Do you think there is a need for subclassing Alert, and AlertMessageKey, that way for example, Dataset.alerts could still contain alerts of type DatasetAlert, and DatasetAlert would only allow a subset of messages? I think maybe for now it's ok to keep it general, and subclass if the alerts need be be more organized, what do you think?
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.
The changes look good!
I like the idea of subclassing Alert. But as you said, it's fine to keep it like this since there are no other types of alerts. We can add the subclasses once there are other type of alerts