fix(frontend): use query-form entity_id for metadata fetches - #738
Open
larsgeorge-db wants to merge 1 commit into
Open
fix(frontend): use query-form entity_id for metadata fetches#738larsgeorge-db wants to merge 1 commit into
larsgeorge-db wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=):but
use-entity-metadata.tsanddata-domain-details.tsxcalled them with the id as a path segment:Those URLs match no registered route, so they fall through to the SPA catch-all (
@app.get("/{full_path:path}")), which returns200 nullfor unmatchedapi/*paths. The domain view'scheckApiResponsethen treatsnullas an error and raises the toast.(The shared
entity-metadata-panel.tsxalready 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.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 of200 null, so such mismatches fail loudly.