Say CarbonImmutable in the models, and share two helpers - #19
Merged
Merged
Conversation
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>
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.
Two bits of drift against CompliancePlatform and ProductSyncManager.
Immutable dates
The app calls
Date::use(CarbonImmutable::class), so every model date attribute is aCarbonImmutableat runtime — confirmed by checkingUser::first()->created_at. Eighteen docblocks still promised a mutableCarbon, which told larastan and the editor that->addDay()would mutate the attribute when it quietly does nothing. CompliancePlatform already had this right.Shared helpers
PaginationArrowwas written identically here and in ProductSyncManager. It moves tocomponents/pagination-arrow.tsx, byte-identical in all three apps, and now carries adata-testhook.useRef+setTimeoutwhereuseDebouncedValuealready 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
applyFiltersthat 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,tscandvp checkclean.🤖 Generated with Claude Code