Repository navigation
fix: event details dialog crashed on a string timestamp - #337
Merged
Merged
Conversation
Since #335 the generated SDK turns date-time fields into Dates, but hey-api's transformer skips a field whose schema is a union, and the event detail's `event` is the DomainEvent union. Its timestamp stayed a string, the formatter called getTime on it, and the dialog never opened. The events store now converts that one field when it loads the detail. A unit test and a Playwright test that opens a real event cover it; the Playwright one fails without the fix.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes
🚀 New features to boost your workflow:
|
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.


Clicking an event in the admin event browser did nothing on main since #335. The page threw
e.getTime is not a functionand the details dialog never opened.hey-api's transformer plugin skips any field whose schema is a union.
EventDetailResponse.eventis the DomainEvent union, so its timestamp stays a string while the generated type saysDate, andformatTimestampcrashed on it. The events store now converts that one field in aselectwhen it loads the detail. Nothing about the generated client changes.Arrays of the union, the browse list and the user overview's recent events, get the first variant's transformer for every item. That converts
timestamp, which every variant has, so those pages are fine. Fields that only some variants carry, such assent_atorcancelled_at, stay strings there too, but nothing formats them; they only show up in the raw JSON view.A store unit test feeds a string timestamp and expects a Date. A new Playwright test opens the first event in the browser and checks the Timestamp row. It fails against a build without the fix and passes with it, along with the rest of the admin events spec. Vitest passes 1062 tests and the gates are clean.
Summary by cubic
Fixes the admin event details dialog crashing when opening an event. Since #335 the generated SDK returns
timestampas a string on the event detail'seventfield — the transformer skips union-typed fields — soformatTimestampcalledgetTimeon a string and the dialog never opened.The events store now converts that field to a
Datewhen loading the detail. Browse lists already work because arrays apply the first variant's transformer, which convertstimestampfor every variant.event.timestampto aDatein the event detail query via aselectcallback.Written for commit b5f6eb5. Summary will update on new commits.