Repository navigation
Refactor: share list query building in baseDataProvider, drop stale comments - #82
Merged
Merged
Conversation
…omments - Extract composeListQuery for the identical query building in getList, getCount and export (URLs unchanged, byte for byte). - Drop the identity map in mergeEncodedQueries. - Replace the upstream usage example in the header docblock, which no longer matches how this provider is built. - Type getCount as Promise<number> and the file-response error's details field instead of casting to any. - Remove commented-out sample phone numbers in YemotSimulator defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012GTictqecCYiBSiCMj1RKN
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.
Part of buzz-code/ops#60
Scope
Weekly tech-debt pass. Only behavior-preserving changes, focused on recently changed code. No API, export or consumer-facing changes, so no CONSUMER_CHANGES.md row is needed.
Changes
providers/baseDataProvider.tsgetList,getCountandexporteach built the same query (q params, filter/$OR, sort, joins, extra). That code now lives in one internal helper,composeListQuery. The builder calls run in the same order as before, becauseRequestQueryBuilderwrites the query-string params in the order they are set.mergeEncodedQueries: removed a.map((query) => query)that did nothing.ra-data-nestjsx-crud, which no longer matched how this provider is built.getCountreturn typePromise<Number>changed toPromise<number>. The error fromfileResponseErrornow has a type with an optionaldetailsfield, so theas anycast is gone.components/views/YemotSimulator.jsx: removed commented-out sample phone numbers fromDEFAULT_VALUES.Helper added
composeListQuery(params, perPage?)inproviders/baseDataProvider.ts(module-internal, not exported): builds the query string for list-style requests. WhenperPageis omitted the query has no pagination (used bygetCount).Tests
getList(plain resource and resource with a query string),getCountandexportbuilt for three param sets (nested filters,$OR,q,extra,perPageover the cap, and undefined filter and sort). The two sets of URLs were identical. The throwaway test is not committed.tsc --noEmitonbaseDataProvider.ts: clean.yarn test: 230 passed, 2 failed, 1 skipped, the same before and after the change. The 2 failures are 5s timeouts inAdvancedSort.test.jsxandCommonEntity.integration.test.jsxunder parallel load. Run with--runInBand --testTimeout=30000, those suites and all provider suites pass (83/83).Generated by Claude Code