Skip to content

Say CarbonImmutable in the models, and share two helpers - #19

Merged
SourovCodes merged 2 commits into
mainfrom
immutable-date-docblocks-and-shared-helpers
Sep 21, 2026
Merged

SourovCodes merged 2 commits into
mainfrom
immutable-date-docblocks-and-shared-helpers

Conversation

@SourovCodes

Copy link
Copy Markdown
Member

Two bits of drift against CompliancePlatform and ProductSyncManager.

Immutable dates

The app calls Date::use(CarbonImmutable::class), so every model date attribute is a CarbonImmutable at runtime — confirmed by checking User::first()->created_at. Eighteen docblocks still promised a mutable Carbon, which told larastan and the editor that ->addDay() would mutate the attribute when it quietly does nothing. CompliancePlatform already had this right.

Shared helpers

  • PaginationArrow was written identically here and in ProductSyncManager. It moves to components/pagination-arrow.tsx, byte-identical in all three apps, and now carries a data-test hook.
  • The shop search kept its own useRef + setTimeout where useDebouncedValue already existed in CompliancePlatform. It now settles a value and only visits when the settled term disagrees with the server, which is the shape the other filter bars use.

I deliberately left ProductSyncManager's debounce alone — its version is coupled to an applyFilters that cancels the pending timeout, which is what makes its sort/search race test pass.

Verification

360 tests pass, including the search box filters the list as the user types. Pint, PHPStan, tsc and vp check clean.

🤖 Generated with Claude Code

SourovCodes and others added 2 commits September 21, 2026 12:47
The app calls Date::use(CarbonImmutable::class), so every date attribute
is immutable at runtime. The docblocks still promised a mutable Carbon,
which told larastan and the editor that ->addDay() would mutate the
attribute when it quietly does nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both were written twice over: the arrow is the same component the product
apps render, and the shop search kept its own timeout where a hook already
existed. The search now settles a value rather than juggling a ref, and
only visits when the settled term disagrees with the server.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@SourovCodes
SourovCodes merged commit a422c8b into main Sep 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant