-
Notifications
You must be signed in to change notification settings - Fork 0
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
Web/fix intial render #1120
Web/fix intial render #1120
Conversation
Refactor to use useRouteLoaderData for more accurate data scoping. Ensures data retrieval is tied specifically to the 'root' route, improving clarity and code reliability.
Replaced memoized Header component with a standard function for clarity and maintainability. Removed unnecessary useCallback and useMemo hooks, simplifying the component logic. This change improves code readability without impacting functionality.
Refactor `ModeToggle` component to improve readability and performance. Replaced `useMemo` usage with direct comparison logic for theme detection. Introduced a reusable `makeToggleHandler` function for cleaner event handling.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Provide clear instructions for scroll management and script tags, including nonce requirements for content security policies. These comments improve clarity for future developers and ensure proper implementation guidelines.
Replace custom document and main components with shared layout utilities. This reduces redundancy and ensures consistency across the app by relying on a centralized layout structure. Related files `document.tsx` and `main.tsx` were removed as they are no longer needed.
This pull request includes several changes across multiple files to improve code consistency and readability. The most important changes involve refactoring components to remove unnecessary hooks and memoization, and updating imports for better type management.
Refactoring components:
apps/web/src/shell/header.tsx
: Refactored theHeader
component to remove thememo
anduseCallback
hooks, and directly define thehandleMobileNavigationClick
function. Simplified the rendering of list items by moving theroutes.map
logic directly into the JSX. [1] [2] [3]packages/ui/src/components/mode-toggle/mode-toggle.tsx
: Refactored theModeToggle
component to remove thememo
anduseMemo
hooks, and replaced them with straightforward logic. Introduced amakeToggleHandler
function to handle theme changes more cleanly. [1] [2] [3]Updating imports:
apps/web/src/root.tsx
: Added theuseRouteLoaderData
import to replaceuseLoaderData
for better type safety and data handling. [1] [2]apps/web/src/shell/header.tsx
: Adjusted the import statement to remove unnecessarymemo
anduseCallback
imports.packages/ui/src/components/mode-toggle/mode-toggle.tsx
: Updated the import statement to replacememo
anduseMemo
withFC
andMouseEventHandler
for better type management.