Fix sphagetti code in web directory and migrate to redux states. - #69
Merged
Conversation
Previously, accessing the shared documents by collaborator resulted in NOT FOUND. This commit fix it by checking if the user is the owner or has valid collaborator/public access.
Update the afterEach hook to explicitly call .destroy() on all active Yjs documents. Also prevents TypeError when running Jest diagnostics.
…ralize icons. Decompose the 1390-line Sidebar.tsx into focused modules under components/sidebar/, extracting the resize logic into a custom hook and sharing types and constants through a single types file. Extract inline SVGs into reusable icon components under web/icons/, replacing duplicates in SharePanel, AuthModal, SettingsModal, and CommentsSidebarHeader. Fix the isSharedLoading default from false to true and add a missing setIsSharedLoading(true) to the isInitializing guard to prevent a flash of empty content before the API responds.
This makes it easier to maintain in the future. Signed-off-by: santhoshh-kumar <santhoshh.kumar.a.d@gmail.com>
This toast container will replace all alert() calls in the app to provide a more user-friendly notification experience.
Previously, we rushed up and never used react store properly and this single commit aims to make a very good progress in migrating to redux states. Moves document list management, sidebar UI state, theme selection, and app-level UI state (auth modal, settings modal, account menu, local docs promotion, toasts) from React component state and hooks into dedicated Redux slices with async thunks. Also replaces alert() calls with toast notifications. Rewrites useDocumentList.hook.ts and useTheme.hook.ts to dispatch thunks and read from the store. Removes the onOpenAuth prop from Sidebar and AppShell, using the ui slice to control the auth modal instead. Updates all test files to wrap components and hooks in a Redux Provider, migrate mock patterns to dispatch spies, and add async waitFor wrappers for store-driven state updates. There's much more improvements that can be made but for now this seems enough and clean to make changes in the future.
Collaborator
Author
|
There have been no tests added for any of the slices introduced. I dunno whether it's worth the time to add now. We should plan to add tests for them in a seperate PR. |
This file contains hidden or 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
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.
This PR also fixes a bug introduced in previous PR -- accessing the shared documents by collaborator resulted in NOT FOUND. Also fixes open handles in realtime tests.
Sidebar and Editor have been refactored from monolithic into modular components which makes the future modifiication easy!
This also replaces alert() with newly introduced ToastContainer component.
Previously, we rushed up and never used react store properly and a single commit in this PR aims to make a very good progress in migrating to redux states.