Skip to content

fix(frontend): use query-form entity_id for metadata fetches - #738

Open
larsgeorge-db wants to merge 1 commit into
developmentfrom
fix-entity-metadata-query-form
Open

larsgeorge-db wants to merge 1 commit into
developmentfrom
fix-entity-metadata-query-form

Conversation

@larsgeorge-db

@larsgeorge-db larsgeorge-db commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a metadata-load failure on entity detail views (reproduced on the Data Domain detail page: a "Metadata load failed — Rich Texts fetch returned null or undefined data" toast).

Root cause

The entity metadata endpoints take the entity id as a query parameter (?entity_id=):

GET /api/entities/{entity_type}/rich-texts?entity_id={id}   (also links, documents, attachments)

but use-entity-metadata.ts and data-domain-details.tsx called them with the id as a path segment:

GET /api/entities/{entity_type}/{id}/rich-texts

Those URLs match no registered route, so they fall through to the SPA catch-all (@app.get("/{full_path:path}")), which returns 200 null for unmatched api/* paths. The domain view's checkApiResponse then treats null as an error and raises the toast.

(The shared entity-metadata-panel.tsx already used the correct query-form, which is why the panel works elsewhere.)

Fix

Switch both callers to the query-form the backend defines, URL-encoding the id (it may be an IRI). Update the hook tests to assert the query-form URLs.

Testing

  • use-entity-metadata.test.ts: 31 passed; frontend typecheck clean.
  • Verified in-app (Playwright): the Data Domain detail page renders with empty-state metadata sections and no error toast, 0 console errors.

Note

This is a pre-existing bug (lines date to Aug 3 / March), independent of any feature work. A follow-up worth considering separately: the SPA catch-all should return 404 for unmatched api/* paths instead of 200 null, so such mismatches fail loudly.

The entity metadata endpoints (rich-texts, links, documents, attachments)
take the entity id as a query param (?entity_id=), but use-entity-metadata
and the data-domain details view called them with the id as a path segment
(/entities/{type}/{id}/rich-texts). Those URLs matched no real route and fell
through to the SPA catch-all, which returns 200 null for unmatched api/*
paths; the domain view's checkApiResponse then raised 'Rich Texts fetch
returned null or undefined data' and showed a 'Metadata load failed' toast.

Switch both callers to the query-form the backend defines (and that the
entity-metadata-panel already uses), URL-encoding the id since it may be an
IRI. Update the hook tests to assert the query-form URLs.

Verified in-app: the domain detail view loads with empty-state metadata
sections and no error toast.

Session: claude -r 01d95399-c840-4b99-b76c-735490295c66
@larsgeorge-db
larsgeorge-db requested a review from a team August 19, 2026 19:22
@larsgeorge-db larsgeorge-db added the stakeholder/nebw Reported by external stakeholder (codename: nebw) label Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stakeholder/nebw Reported by external stakeholder (codename: nebw)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant