Fix emoji loading race conditions
What does this MR do and why?
Support Vite in feature tests
Add patch, so that vue_ruby can be configured from config
Add new test cases for emoji caching
Our caching of emoji in localStorage is tricky and barely tested. This adds the following test cases:
- when the localStorage is empty
- when the localStorage stores the correct version
- when the localStorage stores an incorrect version
These cases are handled fine currently. The following cases are not handled well today:
- when the localStorage contains garbage data (e.g. it got corrupted or manipulated somehow). We currently do not catch the error.
- when the localStorage cannot save the item. We thought we handled the
case correctly, but: We first try to save the
EMOJI_VERSION
in localStorage and then the big blob. So if the saving fails, we have updated the version but not the blob.
Fix emoji loading race conditions
- If the JSON data is corrupted.
- If the JSON data cannot be saved to localStorage because it is too
large. This race condition forces us to bump the
CACHE_VERSION_KEY
because users actively run into this in the wild.
Related to #430754 (closed)
Screenshots or screen recordings
N/A
How to set up and validate locally
- Checkout
243729f54544a4a6332687c5488360cbebeb8eea
and runyarn run jest --watch spec/frontend/emoji/index_spec.js
- See the failing specs
- Checkout the latest commit
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Heinrich Lee Yu