EmbeddedChat icon indicating copy to clipboard operation
EmbeddedChat copied to clipboard

Implemented lazy loading to desired components

Open tazsq opened this issue 1 year ago • 4 comments

Issue #383

Brief Title

implemented lazy loading

Acceptance Criteria fulfillment

  • [x] MessageToolbox in Message.js
  • [x] Menu in ChatHeader.js
  • [x] EmojiPicker in ChatInputFormattingToolbar.js
  • [x] AudioMessageRecorder in ChatInputFormattingToolbar.js
  • [x] ThreadHeader in ChatHeader.js
  • [x] Attachments in Message.js

#Fixes Issue #383

PR Test Details

I have used react lazy, and suspense to ensure the components are rendered upon there first render and the initial bundle size is reduced This pull request introduces code-splitting and lazy loading for several components across different parts of the application to improve performance by reducing the initial load time. The changes primarily involve the use of React's lazy and Suspense for dynamic imports.

Lazy loading and code-splitting:

  • packages/layout_editor/src/views/ChatHeader/ChatHeader.jsx: Added lazy loading for the Menu component and wrapped its usage with Suspense. [1] [2] [3]
  • packages/layout_editor/src/views/Message/Message.jsx: Added lazy loading for the MessageToolbox component and wrapped its usage with Suspense. [1] [2]
  • packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js: Added lazy loading for the EmojiPicker and AudioMessageRecorder components and wrapped their usage with Suspense. [1] [2] [3] [4] [5]
  • packages/react/src/views/Message/Message.js: Added lazy loading for the Attachments and MessageToolbox components and wrapped their usage with Suspense. [1] [2] [3] [4] [5] [6] [7]

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-<pr_number> after approval. Contributors are requested to replace <pr_number> with the actual PR number.

tazsq avatar Nov 19 '24 11:11 tazsq

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 19 '24 11:11 CLAassistant

@Spiral-Memory @sidmohanty11 please review

tazsq avatar Nov 21 '24 03:11 tazsq

Hey @tazsq

We'll have to see if we need lazy loadings here.. maybe we aren't looking for it right now.. still I'll look into it and let you know

Spiral-Memory avatar Nov 21 '24 03:11 Spiral-Memory

Hey @tazsq

We'll have to see if we need lazy loadings here.. maybe we aren't looking for it right now.. still I'll look into it and let you know

Hey @Spiral-Memory @sidmohanty11 can you revert on this issue?

tazsq avatar Dec 07 '24 11:12 tazsq