Skip to content

refactor(hooks): avoid direct Date construction during render in useSteamAchievementsBatch - #373

Merged
finallyjay merged 1 commit into
mainfrom
fix/use-steam-data-render-purity
Oct 8, 2026
Merged

finallyjay merged 1 commit into
mainfrom
fix/use-steam-data-render-purity

Conversation

@finallyjay

Copy link
Copy Markdown
Owner

Problem

Dependabot PR #372 (bumps oxlint 1.85.0 -> 1.86.0) fails the required quality check at the pnpm lint step:

hooks/use-steam-data.ts:59:22: error react(purity): Cannot call impure function during render
help: `Date` is an impure function. ...
Found 0 warnings and 1 error.

oxlint 1.86 adds react(purity) to the correctness category. main (oxlint 1.85.0) lints clean, so the failure comes from the bump.

Fix

The flagged setLastUpdated(new Date()) is inside the render-phase "adjust state when appIds change" branch, which is guarded by prevAppIdsKey !== appIdsKey and runs once per change. The clock read is deliberate there, so it now goes through a small module-level currentTimestamp() helper. Behavior is unchanged.

Verification (local)

After merge, #372 needs a Dependabot rebase to pick this up.

🤖 Generated with Claude Code

…chievementsBatch

oxlint 1.86 adds the react(purity) rule to correctness, which flags the
`new Date()` call in the render-phase state adjustment. The branch only runs
once per appIds change, so route the clock read through a small helper.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@finallyjay
finallyjay enabled auto-merge (squash) October 8, 2026 14:56
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c104bff-4df0-4168-a407-e0f23d217586
📥 Commits

Reviewing files that changed from the base of the PR and between a4fa7df and 004119b.

📒 Files selected for processing (1)
  • hooks/use-steam-data.ts
 _______________________________
< The only circle I like is CI. >
 -------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@finallyjay finallyjay changed the title fix(hooks): avoid direct Date construction during render in useSteamAchievementsBatch refactor(hooks): avoid direct Date construction during render in useSteamAchievementsBatch Oct 8, 2026
@finallyjay
finallyjay merged commit f803c04 into main Oct 8, 2026
5 of 7 checks passed
@finallyjay
finallyjay deleted the fix/use-steam-data-render-purity branch October 8, 2026 14:58
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.

1 participant