Repository navigation
fix(DateInput, DateTimeInput): the sheet's calendar waits for today, so hydration matches - #10400
Conversation
…so a server in another zone no longer causes a mismatch A DateInput or DateTimeInput with presentation="bottom-sheet" keeps its sheet content mounted while closed, and that content read today during render: the anchor month, the month scroller's today marker and the heading. A server and a browser on different dates then render different markup, and React hydration fails. The sheet fields now read today through the shared useToday hook: null on the server and while hydrating. The sheet's content renders once today is known, and its anchor month is derived until then. Reset reads today in its own handler.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 3edbdfc |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput · Storybook | 172.9 kB (not measured) · 16.4 kB CSS (not measured) | 5,629 (not measured) | ✗ · ✓ · ✓ |
| Calendar · Storybook | 62.7 kB (not measured) · 9.9 kB CSS (not measured) | 1,747 (not measured) | ✓ · ✓ · ✓ |
| DateTimeInput · Storybook | 195.4 kB (not measured) · 18.1 kB CSS (not measured) | 3,581 (not measured) | ✓ · ✓ · ✓ |
1 more component
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| PowerSearch | 271.2 kB (not measured) · 23.1 kB CSS (not measured) | — | — · — · — |
Visual changes: 2 snapshots in 1 component
A change is a question for the reviewer, not a failure.
| Component · story | Before | After | Diff |
|---|---|---|---|
| DateInput · Cleared Calendar Selection (neutral, dark) | ![]() |
![]() |
![]() |
| DateInput · Cleared Calendar Selection (neutral, light) | ![]() |
![]() |
![]() |
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: cli +14 · ~5 · −0 (against the merge base's committed report); core +15 · ~9 · −0 (against the merge base's committed report)
Committed API report behind this build: cli 19 rows, core 24 rows; run pnpm api:report.
43 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./api · Types · type SearchResultEntry |
deprecated?: ComponentDeprecation | undefined |
import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …} |
| + | cli |
./authoring · Types · interface ComponentDeprecation |
interface ComponentDeprecation |
import type {ComponentDeprecation} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotDoc |
interface ComponentIconSlotDoc |
import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotStateDoc |
interface ComponentIconSlotStateDoc |
import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface MultiComponentDoc |
deprecated?: ComponentDeprecation |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …} |
| + | cli |
./authoring · Types · interface SingleComponentDoc |
deprecated?: ComponentDeprecation |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface ComponentBaseDoc |
deprecated?: ComponentDeprecation |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface SubComponentDoc |
deprecated?: ComponentDeprecation |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …} |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template' |
| ~ | cli |
./api · Functions · function search |
function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> |
import {search} from '@astryxdesign/cli/api'; search(…) |
| ~ | cli |
./authoring · Types · interface MultiComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …} |
| ~ | cli |
./authoring · Types · interface SingleComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface ComponentBaseDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface SubComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …} |
| + | core |
. · Types · type ComponentIconMap |
type ComponentIconMap<Variant extends string = IconVariant> = { [Slot in ComponentIconSlotName]?: ComponentIconSlotMap[Slot] extends true ? IconName | null | ComponentIconRequest<Variant> : ComponentIconValue<ComponentIconSlotMap[Slot], Variant> } |
import type {ComponentIconMap} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconRequest |
type ComponentIconRequest<Variant extends string = IconVariant> = Readonly<{ icon?: IconName | null; variant?: Variant; size?: IconSize }> |
import type {ComponentIconRequest} from '@astryxdesign/core' |
| + | core |
. · Types · interface ComponentIconSlotMap |
interface ComponentIconSlotMap |
import type {ComponentIconSlotMap} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconSlotName |
type ComponentIconSlotName = keyof ComponentIconSlotMap & string |
import type {ComponentIconSlotName} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconStaticMap |
type ComponentIconStaticMap = Partial<Record<ComponentIconSlotName, IconName | null | ComponentIconRequest<string>>> |
import type {ComponentIconStaticMap} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconValue |
type ComponentIconValue<State, Variant extends string = IconVariant> = IconName | null | ComponentIconRequest<Variant> | ((state: Readonly<State>) => ComponentIconRequest<Variant> | null | undefined) |
import type {ComponentIconValue} from '@astryxdesign/core' |
| + | core |
. · Types · interface DefineThemeInput |
componentIcons?: ComponentIconMap<ThemeIconEntryVariant<IconVariants, Base>> |
import type {DefineThemeInput} from '@astryxdesign/core'; const x: DefineThemeInput = {componentIcons: …} |
| + | core |
. · Types · interface DefinedTheme |
__componentIcons?: Partial<Record<string, StoredComponentIconValue>> @internal |
import type {DefinedTheme} from '@astryxdesign/core'; const x: DefinedTheme = {__componentIcons: …} |
| + | core |
. · Types · interface DefinedTheme |
componentIcons?: ComponentIconStaticMap |
import type {DefinedTheme} from '@astryxdesign/core'; const x: DefinedTheme = {componentIcons: …} |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconMap |
ComponentIconMap (.) |
import {ComponentIconMap} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconRequest |
ComponentIconRequest (.) |
import {ComponentIconRequest} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconSlotMap |
ComponentIconSlotMap (.) |
import {ComponentIconSlotMap} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconSlotName |
ComponentIconSlotName (.) |
import {ComponentIconSlotName} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconStaticMap |
ComponentIconStaticMap (.) |
import {ComponentIconStaticMap} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconValue |
ComponentIconValue (.) |
import {ComponentIconValue} from '@astryxdesign/core/Icon' |
| ~ | core |
. · Components · component DateInput |
prop value?: ISODateString → prop value?: ISODateString | undefined |
<DateInput value={…} /> |
| ~ | core |
. · Components · component DateTimeInput |
prop value?: ISODateTimeString → prop value?: ISODateTimeString | undefined |
<DateTimeInput value={…} /> |
| ~ | core |
. · Components · component TimeInput |
prop value?: ISOTimeString → prop value?: ISOTimeString | undefined |
<TimeInput value={…} /> |
| ~ | core |
Theme targets · target code (Code) |
target code (Code) props [color] → target code (Code) props [color, size] |
defineTheme({components: {'code': {…}}}) |
| ~ | core |
Theme targets · target item (Item) |
target item (Item) props [align, density] → target item (Item) props [align, density] states [disabled, highlighted, selected] |
defineTheme({components: {'item': {…}}}) |
| ~ | core |
Public attributes · attr data-disabled |
attr data-disabled (theme reflection on 30 targets) → attr data-disabled (theme reflection on 31 targets) |
[data-disabled] { … } |
| ~ | core |
Public attributes · attr data-highlighted |
attr data-highlighted (theme reflection on 1 target) → attr data-highlighted (theme reflection on 2 targets) |
[data-highlighted] { … } |
| ~ | core |
Public attributes · attr data-selected |
attr data-selected (theme reflection on 14 targets) → attr data-selected (theme reflection on 15 targets) |
[data-selected] { … } |
| ~ | core |
Public attributes · attr data-size |
attr data-size (theme reflection on 55 targets) → attr data-size (theme reflection on 56 targets) |
[data-size] { … } |
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Requesting changes. The hydration fix itself works: the new SSR test fails on main and passes here, and the existing DateInput and DateTimeInput suites still pass. Three things need to change before this can be approved:
- After hydration,
TouchDateFieldandTouchDateTimeFieldre-derive the opening month from the clock on every render (TouchDateField.tsx:718-726,TouchDateTimeField.tsx:618-623), so on a server-rendered page an open sheet showing November jumps to December on the first render after local midnight on 30 November, while a client-rendered field stays put; store the anchor in the first render that knows today, asCalendardoes, and reword the "then stable for the day" comment. - The User impact line's "(or an adaptive presentation that resolves to the sheet)" describes a mismatch that
maindoes not have, because adaptive presentations server-render and hydrate the pointer field and mount the sheet only afterwards, so please drop it. spec:AST-013FR9's verification row and FR10 ask for a real-browser server render, hydration and post-hydration fixture, so please add both bottom-sheet fields to the existing Calendar today-hydration fixture and browser spec (render on 30 November, hydrate on 1 December, open the sheet, expect December with 1 December as today).
[Automated review]
…h past a month-end midnight (red)
…nth once today is known After hydration the sheet fields re-derived their anchor month from the clock on every render, so an open sheet on a server-rendered page jumped to the next month on the first render after midnight at a month end. They now store it in the first render that knows today, as Calendar does. The Calendar today-hydration fixture and browser spec cover a sheet DateInput and DateTimeInput: rendered on 30 November, hydrated on 1 December, opened on December with 1 December as today.
|
/approve-spec 08e64d2 |
There was a problem hiding this comment.
Requesting changes: the hydration fix works (the new SSR test fails on main and passes here, and an open sheet now keeps its month across a month-end midnight), but one of the new browser tests fails.
- The real-browser
DateTimeInputcase opens the sheet withinput[inputmode="none"], which matches both the date and the time combobox, so Playwright's strict-mode click throws before the sheet opens (CalendarTodayHydration.interaction.browser.spec.ts:86); open it withhost.getByRole('combobox', {name: 'Starts', exact: true})instead.
With a narrower opener, both sheet cases pass in Chromium on this branch and fail on main with React's hydration error, so the component change itself holds up. CI's heavy suites have not run on this head yet, which is where this failure would surface.
[Automated review]
…obox name A DateTimeInput renders a date and a time combobox, so the shared input[inputmode="none"] opener matched two elements and Playwright's strict click threw before the sheet opened. The source comments over the stored opening month are shorter.
|
/approve-spec c676a96 |
There was a problem hiding this comment.
Approved pending CI: the heavy CI suites are deferred on this head and run in the pre-merge re-run (typecheck and lint pass).
The hydration fix holds up. The new SSR test fails on main with React's hydration error and passes here, and all four real-browser hydration cases now pass in Chromium, including the DateTimeInput sheet opened by its combobox name. An open hydrated sheet keeps its month across a month-end midnight, and the existing DateInput, DateTimeInput and Calendar suites pass.
[Automated review]






User impact
DateInputorDateTimeInputthat usespresentation="bottom-sheet", when the server's date differs from the browser's. The usual case is a server in UTC and a visitor in another zone near midnight.Problem and solution fit
new Date()during render, and the server and the browser can be on different dates.This is the same fix the Calendar and DateRangeInput got: today comes from the shared internal
useToday()hook, which is unknown on the server and while hydrating.Expected behavior and authority
spec:AST-013FR9: SSR-capable components do not read user-agent state during the server render or the client render that hydrates. DateInput and DateTimeInput now citespec:AST-013/FR9, and list the new test inverified_by.Smallest restoration
TouchDateFieldandTouchDateTimeFieldread today fromuseToday(). The sheet's content renders once today is known. The opening month is stored in the first render that knows today, as Calendar does, so a render after midnight at a month end does not move an open sheet. Reset reads today in its own handler.MonthScrollertakestoday: PlainDate | null.Evidence
TouchDateToday.ssr.test.tsxfails on main with React's hydration error. It renders the markup on a UTC server at 23:30 on 30 November and hydrates it in a browser whose date is already 1 December.spec:AST-013FR9 verification and FR10). This runs in CI's browser lane.Scope
Testing
pnpm vitest run packages/core/src/DateInput packages/core/src/DateTimeInput packages/core/src/Calendarpnpm check:knowledge