Skip to content

Fix sphagetti code in web directory and migrate to redux states. - #69

Merged
santhoshh-kumar merged 6 commits into
mainfrom
fix/sphagetti-code
Jun 25, 2026
Merged

Fix sphagetti code in web directory and migrate to redux states.#69
santhoshh-kumar merged 6 commits into
mainfrom
fix/sphagetti-code

Conversation

@santhoshh-kumar

@santhoshh-kumar santhoshh-kumar commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@santhoshh-kumar

Copy link
Copy Markdown
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.

@santhoshh-kumar
santhoshh-kumar merged commit 100ddbd into main Jun 25, 2026
10 of 11 checks passed
@santhoshh-kumar
santhoshh-kumar deleted the fix/sphagetti-code branch June 25, 2026 03:26
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.

2 participants