Skip to content

Conversation

@AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Nov 27, 2025

Purpose

During investigations about some users having theirs docs quite slow, we found a method that slow down a lot the users typing on a big documents.

Proposal

  • We are improving the way we listen a upload to avoid this methods.
  • We are improving the listeners on the table of content to listen only when necessary, we added a debounce as well.
  • We fixed a bug on the "Table of Content" about stickiness blocked after a page bigger that 100vh.

@AntoLC AntoLC self-assigned this Nov 27, 2025
@AntoLC AntoLC added bug Something isn't working enhancement improve an existing feature frontend labels Nov 27, 2025
@AntoLC AntoLC changed the title Enhance/hooks editors - ⚡️(frontend) improve performance on some hooks Nov 27, 2025
@AntoLC AntoLC changed the title - ⚡️(frontend) improve performance on some hooks - ⚡️(frontend) improve performance on upload and table of contents Nov 27, 2025
@AntoLC AntoLC changed the title - ⚡️(frontend) improve performance on upload and table of contents - ⚡️(frontend) improve perf on upload and table of contents Nov 27, 2025
@AntoLC AntoLC force-pushed the enhance/hooks-editors branch from 8cb92fa to e608769 Compare November 27, 2025 17:01
@AntoLC AntoLC requested a review from Ovgodd November 27, 2025 17:01
@AntoLC AntoLC changed the title - ⚡️(frontend) improve perf on upload and table of contents (frontend) improve perf on upload and table of contents Nov 28, 2025
@AntoLC AntoLC changed the title (frontend) improve perf on upload and table of contents ⚡️(frontend) improve perf on upload and table of contents Nov 28, 2025
@AntoLC AntoLC force-pushed the enhance/hooks-editors branch 2 times, most recently from 9cea74d to 5598788 Compare December 1, 2025 08:06
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Size Change: +130 B (0%)

Total Size: 4.11 MB

Filename Size Change
apps/impress/out/_next/static/157512fe/_buildManifest.js 0 B -883 B (removed) 🏆
apps/impress/out/_next/static/a1483e48/_buildManifest.js 881 B +881 B (new file) 🆕

compressed-size-action

Copy link
Collaborator

@Ovgodd Ovgodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ! just made a very small proposal ( non blocking )

/* During collaboration, another user might have updated the block */
}
// Add random delay to reduce collision probability during collaboration
const randomDelay = Math.random() * 800;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart I like it

/**
* Replace the resource block by a uploadLoader block to show analyzing status
*/
const replaceBlockWithUploadLoader = useCallback(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to extract this into a utility function if we plan to reuse it later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hypothetical, let's do that when the situation would happen.

- the Table of Contents stickiness now covers the
full height of the viewport, before it was limited to
100vh
- we listen the scroll to highlight the heading
in the Table of Contents only when the Table of Contents
is open
- We debounce the editor change to avoid excessive updates
to the Table of Contents
We notices that `context.getChanges` was very
greedy, on a large document with multiple
users collaborating, it caused performance issues.
We change the way that we track a upload by
listening onUploadEnd event instead of tracking
all changes in the document.
When a doc opens, we check if there are any ongoing
uploads and resume them.
We fix as well a race condition that could happen
when multiple collaborators were on a document
during an upload.
@AntoLC AntoLC force-pushed the enhance/hooks-editors branch from 5598788 to 9aeedd1 Compare December 1, 2025 09:32
@AntoLC AntoLC merged commit 9aeedd1 into main Dec 1, 2025
21 of 22 checks passed
@AntoLC AntoLC deleted the enhance/hooks-editors branch December 1, 2025 09:45
@AntoLC AntoLC mentioned this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement improve an existing feature frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants