fix: render unknown event types with a fallback - #883
Open
cartel9072-design wants to merge 1 commit into
Open
cartel9072-design wants to merge 1 commit into
cartel9072-design wants to merge 1 commit into
Conversation
Adds isKnownEventType + circular-safe payload formatting and wires the fallback presentation into the event feed components. Closes Core-Foundry#612
|
@cartel9072-design Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Overview
Makes the dashboard event feed tolerate event types it has never seen. When the listener forwards a
type/eventNamethat has no presentation mapping, the feed now renders a neutral fallback badge instead of relying on unmapped lookups, and the raw payload is rendered through a crash-proof, inspectable representation, so an unrecognised event can never throw during render.Related Issue
Closes #612
Changes
Unknown event type fallback
[MODIFY]
dashboard/src/utils/eventTypeMapping.tsisKnownEventType()and extractsfindKnownPresentation()so callers can tell a catalogued type apart from the fallback without duplicating the lookup.getEventTypePresentation()keeps returning the neutralUNKNOWN_EVENT_TYPE_PRESENTATIONfor unmapped types and preserves the raw type as the label, so an unrecognised event stays identifiable.[MODIFY]
dashboard/src/utils/payloadViewer.tssanitizePayload()circular-reference safe (path-scopedWeakSet), so arbitrary/unknown payloads stay stringifiable instead of overflowing the stack.formatRawPayload()so non-serialisable values (circular references,BigInt) are caught and still produce inspectable output.formatPayloadPreview(), which always returns a single-line string for inline rendering — preventing "Objects are not valid as a React child" for unknown payload shapes.[MODIFY]
dashboard/src/components/EventCard.tsxCompactCardheader left onmainby the presentation-mapping merge (the file did not parse).title, marks the card withdata-event-type-known="false", and shows an "Unrecognized event type" note in the expanded card.formatPayloadPreview(), andtopicis guarded.[MODIFY]
dashboard/src/components/EventExplorerCard.tsxshortenAddress/copy-handler references, a duplicated<time>opening tag that broke parsing).getEventKind*fallback path and marks unknown kinds with the fallback badge anddata-event-type-known.[MODIFY]
dashboard/src/components/NotificationDetailsDrawer.tsxledger,eventIdor sender address so a partial unknown payload cannot throw during render.[ADD]
dashboard/src/utils/eventTypeMapping.test.ts[ADD]
dashboard/src/utils/payloadViewer.test.tsBigInt,null/undefined).[ADD]
dashboard/src/components/EventCard.unknown.test.tsxVerification Results
isKnownEventType+UNKNOWN_EVENT_TYPE_PRESENTATIONwired intoEventCard,EventExplorerCard,NotificationDetailsDrawerledger/eventId/address, and aformatPayloadPreviewthat never throwseventTypeMapping.test.ts,payloadViewer.test.ts,EventCard.unknown.test.tsxCloses #612