Fix bell update date crash
Closes https://sentry.io/share/issue/ec02862bc2bc49748b0ef76365539eed/
What does this MR do?
In MenuBells.vue
the createdAt
property of each bell is updated by parsing the original value with dateFnsParseISO
.
In the past this did directly update the bell object from the bell store. If the list of bells is updated (e.g. by deleting one), this operation is called again, causing that dateFnsParseISO
is applied to it's own output which results in Invalid Date
.
As a solution the bell object is cloned and only the createdAt
value of the cloned object is updated.
I am open to suggestion for nicer ways to clone objects in js or to solve this in general :)
How confident are you it won't break things if deployed?
Very
Links to related issues
Sentry: https://sentry.io/share/issue/ec02862bc2bc49748b0ef76365539eed/
Slack: https://yunity.slack.com/archives/C1T1ZM9A4/p1584566740386800
How to test
Steps a reviewer can take to verify that this MR does what it says it does e.g.
- Checkout branch locally
- Login as foodsaver
- Create a few bells ( >= 2, e.g. write a few messages on a store wall)
- Try to delete one of the bells
- Check that no JS errors occurred and that the relative times in the bell list (like "two minutes ago") are correct
Checklist
-
added a test, or explain why one is not needed/possible... -
no unrelated changes -
asked someone for a code review -
joined #foodsharing-beta channel at https://slackin.yunity.org -
added an entry to CHANGELOG.md (description, merge request link, username(s)) -
Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings