Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements React Compiler for automatic memoization and fixes React Hooks ESLint violations in the Hydrant codebase. The changes enable the React Compiler babel plugin and activate the react-hooks ESLint rules that were previously commented out.
Changes:
- Adds React Compiler via babel-plugin-react-compiler and vite-plugin-babel configuration
- Enables React Hooks ESLint rules (reactHooks.configs.flat.recommended)
- Refactors components to comply with Rules of Hooks by fixing dependency arrays, converting useEffect to render-time state updates, and extracting components
- Converts setter properties to explicit setter methods in State, Sections, and ClassSections classes for better React Compiler compatibility
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds vite-plugin-babel configuration with babel-plugin-react-compiler for automatic memoization |
| eslint.config.js | Enables react-hooks ESLint rules that were previously commented out |
| package.json | Adds babel-plugin-react-compiler and vite-plugin-babel dev dependencies |
| package-lock.json | Updates lockfile with new babel and vite plugin dependencies |
| src/lib/state.ts | Converts showBanner setter to setShowBanner method and adds setFitsScheduleCallback method |
| src/lib/class.ts | Adds setRoomOverride method and removes declare keyword from kind property |
| src/lib/activity.ts | Adds setRoomOverride method to Sections class |
| src/lib/hydrant.ts | Adds eslint-disable for exhaustive-deps to suppress stable function warnings |
| src/emotion/emotion-client.tsx | Adds eslint-disable for intentional cache mutation |
| src/routes/overrides.($prefillId).tsx | Fixes useCallback dependency array by removing module-level overrides variable |
| src/components/ScheduleSwitcher.tsx | Replaces useEffect with render-time state derivation pattern for syncing props to state |
| src/components/PEClassTable.tsx | Removes unused state dependency from useMemo and updates to use setFitsScheduleCallback method |
| src/components/ClassTable.tsx | Updates to use setFitsScheduleCallback method |
| src/components/Header.tsx | Adds "use no memo" directive to opt-out PreferencesDialog from React Compiler |
| src/components/Banner.tsx | Updates to use setShowBanner method instead of property setter |
| src/components/ActivityButtons.tsx | Adds "use no memo" directives, extracts RenderCheckboxes component, adds key prop for controlled remounting, and removes useLayoutEffect |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Works on fixing React Rule of Hooks ESLint issues and activating automatic memoization using the React Compiler. Also finding a few bugs along the way but... anyways.
Resolves #116