-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Allow default metadata fields to be overridden and edited in place #597
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Good job, @i-a-n! The code looks good to me on first glance.. |
mertkahyaoglu
requested changes
May 13, 2020
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.
Thanks for the pr @i-a-n ❤️ This is really good.
I have 2 comments. After those are addressed, we can merge this 🎉
Co-authored-by: Mert Kahyaoğlu <mertkahyaoglu93@gmail.com>
@i-a-n We can merge this after tests are passing. |
ashmaroli
reviewed
May 17, 2020
mertkahyaoglu
approved these changes
May 17, 2020
Thank you @i-a-n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #596
First PR, happy to receive any additional pushes, and sorry for any inconsistencies.
This allows a user to see the default fields for a new or existing document, choose to "override" the defaults, and revert back to the default at any time. The way I accomplished this in general was by removing the
StaticMetaFields
component, and instead allowingMetaFields
to display both default and additional fields. By checking the redux store (specifically themetadata: { metadata:{} }
object), theMetaFields
component will render each field as either aStatic
or regularMetaField
, and by passing in props, each subcomponent is able to tell whether it is a default field, and whether it is currently in "default mode".Choosing to "override" a default simply adds that key/value to the metadata redux object, allowing it to be rendered as a regular
MetaField
. "Reverting" it simply removes it, and it goes back to being rendered as aStaticMetaField
.Note: I updated snapshot testing and added action/reducer tests, but added no unit tests. I'd appreciate any help or direction on that, if you feel we need them. Thanks again.