-
Notifications
You must be signed in to change notification settings - Fork 1
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
Co 1725 conversation message store refactor #750
Open
giuliano176
wants to merge
114
commits into
devel
Choose a base branch
from
CO-1725-conversation-message-store-refactor
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Introduced `MessageSliceState` to manage message-related state. - Added `MESSAGES_INITIAL_STATE` for initial message state. - Created `createMessageSlice` to initialize message slice state. - Renamed `setMessages` to `setMessagesInSearchSlice` for clarity. - Updated `MessageStoreState` to include `MessageSliceState`.
Refactor setMessagesInMessagesSlice to avoid identical implementation with setMessagesInSearchSlice. This change ensures code consistency and reduces redundancy in the store module.
Renamed all instances of 'search' to 'emails' in the zustand store directory. This change improves clarity and aligns with the updated module naming conventions.
Updated the imports in various files to reflect the new location of the zustand store from `search/store` to `emails/store`. This change ensures consistency and correctness in the import paths across the codebase.
moved slices into separate folders
- Renamed hooks to utils in populated-items directory - Updated function names to remove "Hook" suffix - Adjusted imports in store.ts to use populatedItemsSliceUtils - Ensured all references to hooks are updated accordingly
resume from message-list-component.tsx
This commit simplifies the condition in the useEffect hook within the useMessageList function. The updated condition now only checks if finalQuery has a length greater than 0 before calling firstSearchCallback, removing the redundant check against previousQuery.current.
Refactored the message list component to remove nested ternary operators for better readability and maintainability. Replaced ternary operators with if-else statements to handle different conditions more clearly.
- Added `useMessagesByIds` function in `utils.ts` to filter messages by IDs. - Exported `useMessagesByIds` from `store.ts` for external use. - Updated `populatedItemsSliceUtils` to include `useMessagesByIds`. This enhancement allows efficient retrieval of messages by their IDs.
- Re-enabled `MultipleSelectionActionsPanel` in `message-list-component.tsx`. - Updated `messages-multiple-selection-actions.tsx` to use `useMessagesByIds`. - Refactored `multiple-selection-actions-panel.tsx` to use `useMessagesByIds`. - Cleaned up commented-out code and TODOs related to selection actions. This change restores the functionality of the multiple selection actions panel.
Refactored message-list.tsx to include load more functionality using useLoadMoreForMessagesSlice hook. Removed redundant code and improved performance by memoizing displayerTitle. Updated related hooks and utility functions to support the new functionality.
- Moved DragItems from message-list-component.tsx to a new file message-list-drag-component.tsx - Updated imports and usage in message-list-component.tsx - Removed unused imports and code
- Removed useParams from useMessageList and renamed it to useMessageListByFolder - Added useMessagesIdsByFolder to fetch message IDs by folder - Updated setMessages function to use store instead of draft - Added useMessagesIdsByFolder function to utils - Updated message-list.tsx to use useMessageListByFolder
- Removed deleteMessagesFromMessageSlice function from utils.ts - Updated related references in store.ts and use-msg-move-to-trash.tsx
Refactored the message handling logic in useMessageListByFolder hook. Removed redundant imports and functions, and replaced them with handleSearchSoapApiResults to streamline the code and improve readability.
Added unit tests for the MessageList component to ensure it renders correctly, displays the correct displayer title based on folderId, and renders the correct number of list items. This improves the reliability and maintainability of the component.
Refactored the error handling logic in the `useMsgCreateAppointmentFn` function to reduce code duplication. Introduced `errorSnackbar` function to handle error snackbar creation. Updated the API call to use `getMsgSoapAPI` and normalized the response using `normalizeMailMessageFromSoap`.
Replaced redux hooks with zustand hooks in the MessagePreviewPanel component. This change improves state management by using the `useCompleteMessage` hook from zustand, simplifying the code and removing unnecessary dependencies.
Deleted the outdated `messages-slice.test.js` file from the `src/store/tests` directory. This test was no longer relevant due to recent changes in the messages slice implementation and has been replaced by more comprehensive tests.
Deleted the `use-request-debounced-message.test.ts` file as it is no longer needed. The functionality covered by this test has been deprecated and replaced by new implementations in the codebase.
Fixed an issue in `use-msg-create-appointment.tsx` where the message normalization was incorrectly applied. Updated the `normalizeMailMessageFromSoap` function to use the first element of the response array, ensuring proper message handling.
Ensure all state updates in the sorting tests are wrapped in the act function from @testing-library/react to prevent console errors about unwrapped state updates. This change improves test reliability and ensures proper handling of state updates during tests.
Ensure all state updates in html-message-renderer tests are wrapped in the act function from @testing-library/react to prevent console errors about unwrapped state updates. This change improves test reliability and ensures proper handling of state updates during tests.
- Replace `acceptSharedCalendarReply` with `acceptSharedFolderReply` - Simplify `mountSharedFolder` import statement - Remove unused `dispatch` from dependencies in `useAccept` and `useDecline` - Update `moveInviteToTrashFunc` call to exclude `dispatch` parameter
- Add `msgActionResponse` object to `createSoapAPIInterceptor` call - Ensure `MsgAction` interceptor includes response with `id` and `op`
Deleted the use-request-debounced-message hook as it is no longer needed. Updated use-msg-create-appointment to handle message creation without debouncing. Simplified the code by removing unnecessary dependencies.
Updated use-msg-create-appointment to use the new getMsg API helper instead of getMsgSoapAPI. Inlined the errorSnackbar function to simplify the code and removed unnecessary imports.
Refactored state management slices for better clarity: - Renamed message slice to messagesIndexSlice - Renamed search slice to searchIndexSlice - Added conversationsIndexSlice for conversation indices Updated references and tests. Additionally: - Enhanced error handling in async actions - Optimized selectors for performance - Updated documentation
Added utility functions for managing conversations in the emails store. These include setting conversations, appending conversations, resetting conversations and populated items, updating loading status, and fetching conversation IDs by folder. This enhances the functionality and maintainability of the emails store.
Refactored the ConversationPreviewPanel component to simplify its logic and improve readability. Removed unnecessary imports and hooks, and replaced them with a more streamlined approach using useCompleteConversation. This change enhances the maintainability and performance of the component.
Updated the initial state reference in the conversations utils to use CONVERSATIONS_INDEX_SLICE_INITIAL_STATE instead of MESSAGES_INDEX_SLICE_INITIAL_STATE. This change ensures consistency and correctness in the state management of conversations.
Renamed variable messageIds to messagesIds for consistency and clarity throughout the MessageList component. This change improves code readability and maintainability.
Refactored conversation handling to use Zustand for state management. Updated various components and hooks to align with the new state management approach. Temporarily disabled some tests and actions related to conversations for further fixes (CO-1725).
Renamed `conversationIds` and `messageIds` fields to `conversationIdSet` and `messageIdSet` respectively for consistency and clarity. Updated all references and tests accordingly.
This commit updates the naming convention for the message index slice state from MessagesIndexSliceState to MessageIndexSliceState. This includes changes in various files such as hooks, utils, tests, and store. The changes ensure consistency and clarity in the codebase.
Renamed conversationsIndexSlice to conversationIndexSlice for consistency across the codebase. Updated all relevant imports, types, and function names to reflect this change. This improves code readability and maintainability.
Removed unused fields from MessageIndexSliceState and ConversationIndexSliceState to simplify the code and improve maintainability. This change helps in reducing unnecessary complexity and potential confusion in the state management.
Renamed messagesIds to messageIdSet for better clarity and consistency. This change improves code readability and aligns with the naming conventions used in the project. Updated all relevant references to reflect this change.
Corrected the destructuring of variables in useMessagesIdsByFolder function to ensure proper assignment and usage.
Updated handleSearchSoapApiResults to ensure proper state reset by adding return statements and moving resetMessagesAndPopulatedItems and updateMessagesResultsLoadingStatus calls outside conditionals.
Renamed all instances of messagesIds to messageIdSet in message-list.tsx to improve code readability and consistency.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.