Skip to content

Findings from react-hooks v7 compiler rules (incl. probable typo bug in firebase.ts) #30

Description

@SpainTrain

While bumping eslint-plugin-react-hooks to v7 (ESLint 10 migration), its new React Compiler rules flagged two pre-existing patterns in frontend/src. The lint config pins the classic v5-era rules for now to keep the tooling migration behavior-neutral — these findings deserve their own fix PR:

  1. src/firebase.ts:146 — probable typo bug (the real find):

    const updatedUserRecord = UserRecordSchema.parse(doc.data())
    if (!isEqual(updateUserRecord, userRecord)) {   // <-- compares the *function* updateUserRecord
      setUserRecord(updatedUserRecord)
    }

    updateUserRecord is a function declared later in the hook; the comparison presumably meant updatedUserRecord. As written, !isEqual(fn, record) is always true, so setUserRecord fires on every Firestore snapshot — the dedup check is a no-op. Fix: compare updatedUserRecord. Also note the effect's dep array [uid] omits its other dependencies (the pre-existing exhaustive-deps warning).

  2. src/LocationWidget.tsx:132 — marker.position = ... inside useEffect mutates the Maps marker instance. Imperative mutation is how the Google Maps API works, so this is likely fine — either keep and locally disable the rule with a comment, or restructure.

After fixing, consider adopting reactHooks.configs.recommended (v7 full preset) in frontend/eslint.config.js instead of the pinned classic rules.

Found during the 2026-08-04 ESLint 10 migration; see the frontend ESLint 10 PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions