Skip to content

refactor: improve useVisitorData mount fetch and request-source handling#199

Draft
erayaydin wants to merge 8 commits into
inter-2315/eslint-upgradefrom
chore/eslint-upgrade-inter-2222
Draft

refactor: improve useVisitorData mount fetch and request-source handling#199
erayaydin wants to merge 8 commits into
inter-2315/eslint-upgradefrom
chore/eslint-upgrade-inter-2222

Conversation

@erayaydin

@erayaydin erayaydin commented Jun 20, 2026

Copy link
Copy Markdown
Member
  • Folded #201 into this branch; ESLint upgrade work lives there
  • Refactor useVisitorData to track getVisitorData in config state, re-enter loading when the request source changes, and fetch on mount without a react-hooks/set-state-in-effect disable
  • Add coverage for the request-source loading transition

Discussion point: mount fetch path

Mount now calls currentGetVisitorData directly instead of going through getData(). That avoids the synchronous setState-in-effect lint, but means mount success/error handling is duplicated with getData. Prefer this, or a shared helper?

Note: merge order

Land #201 first; this PR is the follow-up called out in that merge plan.

Use `@fingerprintjs/eslint-config-dx-team@2.0.0` which requires ESLint
v10.

Related-Task: INTER-2222
@erayaydin erayaydin self-assigned this Jun 20, 2026
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
82.64% (-0.32% 🔻)
119/144
🟡 Branches
71.08% (+2.66% 🔼)
59/83
🟢 Functions
81.82% (+0.87% 🔼)
36/44
🟢 Lines
82.01% (-0.29% 🔻)
114/139
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 use-visitor-data.ts
90.63% (-5.03% 🔻)
100%
85.71% (+5.71% 🔼)
90.63% (-5.03% 🔻)

Test suite run success

23 tests passing in 15 suites.

Report generated by 🧪jest coverage report action from 8b73326

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟢 All files 82.63 71.08 81.81 82.01
🟢  src 87.32 80.55 85 86.95
🟢   detect-env.ts 90 83.33 100 90 15,87
🟢   env.ts 100 100 100 100
🟢   env.types.ts 85.71 40 50 83.33 14
🟡   ...nt-context.ts 75 100 0 75 8
🟡   get-env.ts 60 0 100 60 8-9
🟢   ssr.ts 100 100 100 100
🟢   ...sitor-data.ts 90.62 100 85.71 90.62 111-119
🟢  src/components 91.66 58.33 91.66 91.17
🟢   ...-provider.tsx 90.32 54.54 90.9 89.65 47,52,85
🟢   ...vironment.tsx 100 100 100 100
🟡  src/utils 64.86 69.56 66.66 63.88
🟡   ...is-defined.ts 50 75 100 50 3
🟡   to-error.ts 66.66 50 100 66.66 6
🟢   ...mise-store.ts 91.3 92.3 100 90.9 20,26
🔴   wait-until.ts 0 0 0 0 8-19

@erayaydin erayaydin marked this pull request as ready for review June 22, 2026 18:15
@erayaydin

Copy link
Copy Markdown
Member Author

Moving the PR to draft since we're planning to upgrade @fingerprintjs/eslint-config-dx-team to ^3.0.0 instead of ^2.0.0.

@erayaydin erayaydin marked this pull request as draft July 9, 2026 12:42
@JuroUhlar JuroUhlar changed the base branch from main to inter-2315/eslint-upgrade July 16, 2026 12:20
@JuroUhlar JuroUhlar force-pushed the inter-2315/eslint-upgrade branch from 60426e1 to eb3a7a7 Compare July 16, 2026 12:23
@JuroUhlar JuroUhlar changed the title INTER-2222: Upgrade to ESLint v10 flat config refactor: improve useVisitorData mount fetch and request-source handling Jul 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR doesn't contain any changesets. If there are user-facing changes, don't forget to run:

pnpm exec changeset

to create a changeset.

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.

2 participants