Closed jduffy3 closed 3 years ago
That should be fixed now @sbrudz
I actually had that change in before but failed to push it up! Nice catch!
:tada: This PR is included in version 2.0.0-beta.7 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 2.1.0-beta.1 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 2.1.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
I experimented with updating the JustNotSorry class component into being more 'class like'
Quite a few changes around these files. Hopefully for the better! π πΏ π
Most of the challenges I found were wrapping my head around the Debounce function and the MutationObserver callbacks.
Part of the performance issues stemmed from:
1 - removing the editableDivCount we used before. This is because gmail manages multiple contentEditable divs for email messages. Outlook however only ever keeps one. So this meant removing the editableDivCount check. Removing this meant that our mutation callbacks increasing our runtime.
2 - multiple event listeners being added. I'm not sure when exactly it was introduced but if you add console.logs to the debounced methods you can see every time a user blurs and focus'es back on a frame that the number of event listeners duplicate.
3 - recalculateStyle - in a performance review from chrome DevTools we can see getBoundingClientRect() being at the top of the stack, there was a slight quick win by adding this to state since the boundingClientRect is the parent node and will be the same for every warning within one email.
Fixes involved
1 - mutation callback forEachUniqueContentEditable This callback maintains a Set of ids, its essentially the same as editableDivCount, for scenarios like microsoft outlook it just maintains a tempId variable that will increment each time if a id is not found on the div.
2 - MESSAGE_PATTERNS constant - made this a "static" object to save us having to constantly create a new object each time, also removed some unused variables, not sure how much of a gain is achieved.