Fix unsafe type casts via shared entityPresentationSnapshot utility
Extract entityPresentationSnapshot helper to eliminate unsafe `as Entity` casts when passing CompoundEntityRef to EntityPresentationApi.forEntity(), which only accepts Entity | string. The helper safely discriminates input types and stringifies CompoundEntityRef before calling the API. - Add entityPresentationSnapshot as a public export from catalog-react - Remove duplicated getEntityTitle/getTitle helpers across 5 files - Fix useAsync dependency array in TemplateFormPreviewer - Update TSDoc across all presentation API surfaces to reference the new helper - Update entity-presentation.md docs with usage guidance and migration table Made-with: Cursor Signed-off-by: Marat Dyatko <maratd@spotify.com>
This commit is contained in:
+1
-1
@@ -186,7 +186,7 @@ export const TemplateFormPreviewer = ({
|
||||
severity: 'error',
|
||||
}),
|
||||
),
|
||||
[catalogApi],
|
||||
[catalogApi, entityPresentationApi, alertApi],
|
||||
);
|
||||
|
||||
const handleSelectChange = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user