Skip to content

React Hooks + Compiler#262

Open
dtemkin1 wants to merge 16 commits intosipb:mainfrom
dtemkin1:compiler
Open

React Hooks + Compiler#262
dtemkin1 wants to merge 16 commits intosipb:mainfrom
dtemkin1:compiler

Conversation

@dtemkin1
Copy link
Collaborator

@dtemkin1 dtemkin1 commented Dec 7, 2025

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

@dtemkin1 dtemkin1 marked this pull request as ready for review February 20, 2026 20:12
@dtemkin1 dtemkin1 requested review from Copilot and psvenk February 20, 2026 20:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

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.

React compiler linting

2 participants