Skip to content

Dedup fetch entries by (method, endpoint) — fixes #31#32

Merged
kurtstohrer merged 2 commits into
mainfrom
fix/issue-31-fetch-method-dedup
Apr 21, 2026
Merged

Dedup fetch entries by (method, endpoint) — fixes #31#32
kurtstohrer merged 2 commits into
mainfrom
fix/issue-31-fetch-method-dedup

Conversation

@kurtstohrer

Copy link
Copy Markdown
Owner

Summary

Fixes #31. Two fetch() calls to the same endpoint with different HTTP methods (e.g. GET + PATCH on /api/tenants/:id) were silently collapsed into a single catalog entry by the data source scanner. Mutations that shared a URL with an earlier read in the same file were invisible in the Data tab and to agents.

  • Added optional method field to ProjectDataEntry
  • Extract method from axios.<verb>, fetch / ofetch / $fetch options, and hx-* attributes; default to GET
  • Replaced the non-greedy inline-call regex with a balanced-paren walker so the options object stays visible past nested encodeURIComponent(...), JSON.stringify(...), and template expressions — that was the reason method: 'PATCH' wasn't seen
  • Dedup key is now (method, endpoint) per file; method is also included in display_name and the binding-graph key so GET + PATCH pairs stay distinct in the sidebar and overlays

Test plan

  • pnpm exec vitest run — 224 passed (16 files), including new regression case reproducing the issue-report snippet
  • pnpm typecheck — clean
  • Sanity-check the Data tab in a stress-test MFE with a GET + PATCH fetch to the same path

Two fetch() calls to the same endpoint with different HTTP methods (e.g.
GET + PATCH on /api/tenants/:id) collapsed into a single catalog entry,
hiding mutations that shared a URL with an earlier read in the same file.

- Add optional `method` field to ProjectDataEntry
- Extract method from axios.<verb>, fetch/ofetch/$fetch options, hx-* attrs
- Replace non-greedy inline-call regex with a balanced-paren walker so the
  options object is visible past nested encodeURIComponent(...) etc.
- Include method in display_name and the binding-graph key
@kurtstohrer kurtstohrer merged commit c857b15 into main Apr 21, 2026
4 of 5 checks passed
@kurtstohrer kurtstohrer deleted the fix/issue-31-fetch-method-dedup branch April 21, 2026 20:49
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.

Data source scanner deduplicates fetch entries by (name, endpoint, file), hiding mutations to the same endpoint

1 participant