Fix new author creation error on socials
fixes #3576
Both GdocBase instances and OwidGdocBaseInterface objects implement the same interface. However, GdocBase instances leak methods into loadGdocFromGdocBase, which override subclasses implementations.
With regards to overriding the GdocAuthor subclass with an instance of the parent class, three approaches have been reviewed:
- (selected) lodash
defaults(see description in code) - lodash
omitBy(see description in code) - GdocBase.toJSON: addresses a problem with similar roots
This PR only fixes GdocAuthor, but we should expand this to all Gdoc* subclasses created by the loadGdocFromGdocBase factory function.
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @mlbrgl and the rest of your teammates on
Graphite
Quick links (staging server):
| Site | Admin | Wizard |
|---|
Login: ssh owid@staging-site-fix-author-creation
- Site-screenshots: https://github.com/owid/site-screenshots/compare/fix-author-creation
- SVG tester: https://github.com/owid/owid-grapher-svgs/compare/fix-author-creation
SVG tester:
Number of differences (default views): 0Number of differences (all views): 0
Edited: 2024-05-06 14:05:32 UTC Execution time: 1.23 seconds
@ikesau if you haven't started reviewing this, let me re-assign to @danyx23, as he ran into a similar issue I believe. I'll assign you the next one.
If this is causing issues in other places, could you update all the other GdocBase inheritors to use defaults too? 🙂
I like the verbose comments :) - thanks for fixing this, Matthieu! I agree that it would be nice to do this for all classes already in this PR
yes, I'm indeed using long comments as a warning and a deterrent: the longer the comment the more I'll think about changing this line in the future 😄
thank you both for the review, I've updated the other classes.