Conversation
There was a problem hiding this comment.
Pull request overview
Bug-fix PR for the React SPA’s entity browsing and fault rendering: it aims to prevent empty Data tabs during rapid entity switching, and to harden fault timestamp parsing against unexpected gateway payloads.
Changes:
- Add defensive parsing for
RawFaultItem.first_occurredintransformFault, falling back to “now” on invalid/missing values. - Add new unit tests covering non-numeric / missing
first_occurred. - Add a “self-fetch” fallback in
EntityDetailPanel’s Data tab when parent-providedtopicsDatais empty.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/lib/transforms.ts |
Adds defensive first_occurred parsing to avoid Invalid Date / exceptions. |
src/lib/transforms.test.ts |
Adds tests for timestamp fallback and ISO-string parsing cases. |
src/components/EntityDetailPanel.tsx |
Adds Data tab self-fetch fallback to mitigate empty state during entity switches. |
mfaferek93
reviewed
Apr 14, 2026
…flash Before: the Data tab panel read `topicsData` as `ComponentTopic[]` seeded with `[]`. When the user switched entities the parent cleared the array and then started a fetch; the child could render a full "no data" panel for the new entity before the fetch resolved, regardless of what the new entity actually had. Now: `topicsData` is `ComponentTopic[] | null`. The parent resets it to `null` at the start of every fetch (including the unsupported-type branches and on error), and sets it to an array once the response is in. The Data tab renders a skeleton for `null`, the normal list for a non-empty array, and the empty/fallback state for `[]`. This removes the need for a second in-flight request from the child component and gives the fetch effect a single source of truth.
a02224b to
d66406d
Compare
8 tasks
Accept unix-seconds numbers, ISO 8601 strings, and fall back to the current time for zero, negative, missing, or otherwise invalid values instead of letting `new Date()` produce "Invalid Date" in the UI. Widen `RawFaultItem.first_occurred` to `number | string | null | undefined` so the type reflects the shapes the transform actually handles and the fallback branches are not unreachable at the type level.
d66406d to
af06e6b
Compare
Contributor
Author
|
Follow-up on @mfaferek93's review comments left on #66 that apply to the timestamp logic living here:
Pushed as af06e6b. Tests + lint + typecheck clean. |
mfaferek93
approved these changes
Apr 14, 2026
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.
Pull Request
Summary
Two small independent fixes for entity browsing and fault rendering:
The Data tab no longer flashes an empty state on entity switch.
topicsDatainEntityDetailPanelis nowComponentTopic[] | nullso the Data tab can distinguish three states explicitly:null-> parent fetch in flight, render a skeleton[]-> loaded with no items, fall through totopicsInfo/ empty state[...]-> render the listThis replaces the earlier self-fetch workaround with a single-owner flow (the parent effect is the only fetcher, resets to
nullat the start of each entity switch and on error) per review feedback. No duplicate HTTP request, no stalelocalDatacarry-over.transformFaulttolerates unexpectedfirst_occurredvalues (zero, negative, ISO 8601 strings, missing/invalid) and falls back to the current time, preventingInvalid Datein the fault list.RawFaultItem.first_occurredis widened tonumber | string | null | undefinedso the type reflects what the transform actually accepts.Issue
Type
Testing
npm run lintcleannpm run typecheckcleannpm test- 355 tests pass (5 new tests for defensive timestamp parsing)npm run buildsucceedsChecklist
npm run lint)npm run build)