Repository navigation
Add has_records flag to top-level list APIs - #376
Open
ashraful1971 wants to merge 2 commits into
Open
ashraful1971 wants to merge 2 commits into
ashraful1971 wants to merge 2 commits into
Conversation
List pages guessed their first-use empty state from `total === 0` and the active filters. The server now reports whether the table holds any record, independent of search and filters. - Add ListPaginator, a Paginator subclass that adds `has_records` to the paginated payload. It accepts a bool or a fresh unfiltered query, and runs `exists()` only when the page total is 0. - Return it from products, orders, variants, collections, categories, tags, brands, customers and coupons. Products ignore trashed rows; orders scope the check to the customer when one is given. - Read `has_records` on the nine list pages and remove the @todo guesses. - Cover it with a unit test, integration tests per endpoint, and a list-page empty-state test. - Update docs/data-table.md, add the list-record-presence spec and archive the list-api-has-record change.
An order's tax total already holds its shipping tax, and its shipping total is gross of that tax. Net sales subtracted both in full, so the shipping tax was removed twice. Subtract the shipping total without its tax instead. - Sum base_shipping_tax_amount in the dashboard totals query. - Add an integration test for an order with shipping tax. - Update the net sales formula in docs/home.md and the merchant-home-dashboard spec.
ahamed
requested changes
Oct 16, 2026
Comment on lines
+125
to
+127
| $has_records = Order::query()->when(is_numeric($dto->customer_id), function (QueryBuilder $query) use ($dto) { | ||
| return $query->where('customer_id', $dto->customer_id); | ||
| }); |
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.
Summary
List pages guessed their first-use empty state from
total === 0and the active filters. The server now says if the table holds any record, whatever the search or filters.ListPaginator(extends the frameworkPaginator) addshas_recordsto the paginated payload. It takes aboolor a fresh unfiltered query. A query runsexists()only when the page total is 0, so a page with rows costs no extra query.has_recordsand the@todoguesses are gone. Only an explicitfalseshows the first-use state, so loading and failed requests keep the table.base_tax_totalandbase_shipping_totalboth hold the shipping tax, so net sales now subtracts the shipping total without its tax.list-record-presencespec, archives thelist-api-has-recordchange, and updatesdocs/data-table.md,docs/home.mdand themerchant-home-dashboardspec.Test plan
composer test:unit(415 pass), including the newListPaginatorTestfalse, a no-match search keepstrue, products with only trashed rows givefalseDashboardApiTest(13 pass), including a new shipping tax casenpm run typecheck && npm testinresources/app(1552 pass), including the new list-page empty-state testStorePresetsTest"Presets leave order and invoice numbering unchanged" fails in a full integration run with and without this change, and passes alone.