Skip to content
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

Prevent Slate errors by unifying the comment popups. #4804

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

seanparsons
Copy link
Contributor

Problem:
When adding a comment, an exception is thrown from Slate when confirming the comment contents.

Cause:
In the blur handler of ReactEditor in react-slate, there's a lookup which attempts to find the underling DOM node of the text editor in question. For whatever reason (potentially related to the weakmap it uses under the hood of this) it is unable to match the editor and then throws an exception as a result.

Fix:
Slightly bizarrely the solution was to not have the Composer component be unmounted which has been achieved by unifying the comment handling so that new and existing threads are handled by the same component.

Commit Details:

  • Remove NewCommentPopup component.
  • Modified the rendering of CommentThread to handle a null for thread.
  • Created getLiveblocksEditorElement and triggerAutoFocus utility callbacks.
  • Added triggerAutoFocus to onSubmitComment so that creating a new thread auto focuses the new thread edit field.

- Remove `NewCommentPopup` component.
- Modified the rendering of `CommentThread` to handle a null for
  `thread`.
- Created `getLiveblocksEditorElement` and `triggerAutoFocus` utility
  callbacks.
- Added `triggerAutoFocus` to `onSubmitComment` so that creating a new
  thread auto focuses the new thread edit field.
Copy link
Contributor

github-actions bot commented Jan 29, 2024

Try me

Copy link

relativeci bot commented Jan 29, 2024

Job #10090: Bundle Size — 59.82MiB (-0.01%).

5ca5c99(current) vs 3e1b120 master#10084(baseline)

Warning

Bundle contains 66 duplicate packages – View duplicate packages

Bundle metrics  Change 3 changes Improvement 1 improvement
                 Current
Job #10090
     Baseline
Job #10084
Improvement  Initial JS 45.64MiB(-0.02%) 45.65MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 23.56% 53.59%
No change  Chunks 27 27
No change  Assets 31 31
Change  Modules 4502(-0.04%) 4504
No change  Duplicate Modules 582 582
No change  Duplicate Code 27.54% 27.54%
No change  Packages 462 462
No change  Duplicate Packages 65 65
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
Job #10090
     Baseline
Job #10084
Improvement  JS 59.81MiB (-0.01%) 59.82MiB
Not changed  HTML 11.87KiB 11.87KiB

View job #10090 reportView fix/unify-comment-popup branch activityView project dashboard

@seanparsons seanparsons merged commit 0fb5ed0 into master Jan 30, 2024
13 of 15 checks passed
@seanparsons seanparsons deleted the fix/unify-comment-popup branch January 30, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants