-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[FIX] Google My Business pagination #18343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughIntroduces server-side pagination for Google My Business account/location/review selectors by adding prevContext.pageToken handling and returning nextPageToken in options. Updates listAccounts/listLocations/listReviews method signatures to generic args/unknown returns. All other changes are version bumps across actions, sources, and package.json. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as UI Selector
participant App as GMB App (options)
participant API as Google Business API
User->>UI: Open selector (account/location/review)
UI->>App: options({ prevContext: { pageToken } })
App->>API: GET list(..., pageToken)
API-->>App: items[], nextPageToken
App-->>UI: options: items[], context: { nextPageToken }
alt More pages
User->>UI: Load more
UI->>App: options({ prevContext: { pageToken: nextPageToken } })
App->>API: GET list(..., nextPageToken)
API-->>App: items[], nextPageToken'
App-->>UI: items[], context: { nextPageToken' }
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks (3 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🧹 Nitpick comments (6)
components/google_my_business/actions/list-all-reviews/list-all-reviews.ts (1)
11-11: Version bump OK — guard$summaryagainst non-array responses.Replace
response.lengthwithArray.isArray(response) ? response.length : response?.reviews?.length ?? 0.
Location: components/google_my_business/actions/list-all-reviews/list-all-reviews.ts:44components/google_my_business/sources/new-post-created/new-post-created.ts (1)
13-13: Version bump OK — paginate flag confirmed; add docsConfirmed: components/google_my_business/app/google_my_business.app.ts defines async listPosts(..., paginate = true) and uses an if (paginate) branch — listPosts(params, false) disables pagination. Add a short JSDoc above listPosts stating the boolean disables pagination (default: true) and ensure the default behavior remains true after the version bump.
components/google_my_business/app/google_my_business.app.ts (4)
176-181: Type tightening (optional).
Keep signatures consistent with_httpRequestto improve DX.Apply:
- listAccounts(args: object = {}): Promise<unknown> { + listAccounts(args: Omit<HttpRequestParams, "url"> = {} as Omit<HttpRequestParams, "url">): Promise<object> {
117-121: Minor: labels for reviews rely ontitle.
If titles are sometimes empty, consider fallback tonamesnippet. Optional.- label: title, + label: title || this.getCleanName(name) as string,
139-141: Header merge (optional).
Current spread overwrites any caller-provided headers. Consider merging to preserve them while ensuring Authorization wins.- headers: this._getHeaders(), + headers: { ...(args as any).headers, ...this._getHeaders() },
151-151: Type correctness (optional).
InitializepageTokenas possibly undefined to satisfy TS and reflect first-page call.- let pageToken: string; + let pageToken: string | undefined;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
components/google_my_business/actions/create-post/create-post.ts(1 hunks)components/google_my_business/actions/create-update-reply-to-review/create-update-reply-to-review.ts(1 hunks)components/google_my_business/actions/get-reviews-multiple-locations/get-reviews-multiple-locations.ts(1 hunks)components/google_my_business/actions/get-specific-review/get-specific-review.ts(1 hunks)components/google_my_business/actions/list-all-reviews/list-all-reviews.ts(1 hunks)components/google_my_business/actions/list-posts/list-posts.ts(1 hunks)components/google_my_business/app/google_my_business.app.ts(4 hunks)components/google_my_business/package.json(1 hunks)components/google_my_business/sources/new-post-created/new-post-created.ts(1 hunks)components/google_my_business/sources/new-review-created-multiple-locations/new-review-created-multiple-locations.ts(1 hunks)components/google_my_business/sources/new-review-created/new-review-created.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/google_my_business/app/google_my_business.app.ts (1)
components/google_my_business/common/responseSchemas.ts (3)
Account(9-12)Location(5-7)Review(18-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
🔇 Additional comments (13)
components/google_my_business/actions/list-posts/list-posts.ts (1)
12-12: Version bump only — listPosts still returns an array (Promise<LocalPost[]>)Confirmed: components/google_my_business/app/google_my_business.app.ts declares async listPosts(...): Promise<LocalPost[]>; callers in components/google_my_business/actions/list-posts/list-posts.ts and components/google_my_business/sources/new-post-created/new-post-created.ts call this.app.listPosts(...) and expect an array. No changes needed.
components/google_my_business/actions/get-reviews-multiple-locations/get-reviews-multiple-locations.ts (1)
11-11: Version bump OK — location propDefinition supports paginationcomponents/google_my_business/app/google_my_business.app.ts: the "location" propDefinition's async options accept prevContext.pageToken and return context.pageToken = response?.nextPageToken (and the action's locationNames prop reuses that definition as a string[]), so multi-select pagination is supported.
components/google_my_business/actions/get-specific-review/get-specific-review.ts (1)
11-11: Version bump OK — verify "review" prop paginationrg shows a listReviews call passing params.pageSize=50 and a listReviews implementation in components/google_my_business/app/google_my_business.app.ts (call ≈lines 97–105; impl ≈lines 190–194), but no propDefinition for app "review" was found — confirm the propDefinition wires params.pageToken into the list call and that pageToken is advanced/forwarded on subsequent requests so pages actually paginate.
components/google_my_business/sources/new-review-created/new-review-created.ts (1)
13-13: Verify listReviews return type after version bumpSource version bump is fine — confirm app.listReviews still returns Review[] (not
unknownor a paginated wrapper). If it returns a wrapper/unknown, tighten the types or add a safe cast.Locations: components/google_my_business/app/google_my_business.app.ts (refs at ~101, ~190); Review interface: components/google_my_business/common/responseSchemas.ts:18.
components/google_my_business/sources/new-review-created-multiple-locations/new-review-created-multiple-locations.ts (1)
16-16: Version bump only — LGTM.No functional changes in this file.
components/google_my_business/actions/create-post/create-post.ts (1)
15-15: LGTM: version bump only.
No behavioral changes introduced.components/google_my_business/actions/create-update-reply-to-review/create-update-reply-to-review.ts (1)
11-11: LGTM: version bump only.
No functional changes.components/google_my_business/app/google_my_business.app.ts (6)
5-6: Imports look consistent with new usages.
HttpRequestParams,PaginatedRequestParams, etc., are referenced below.
26-31: Usage of listAccounts is fine once prevContext is optional.
No further changes needed here.
31-38: Options mapping looks good.
Labels and values are sensible.
38-43: Consistent pagination context return.
Good:nextPageToken ?? null. Matches sentinel usage.
65-73: Query filter and readMask look correct for BI API.
No change requested.
82-86: Good: returns options with pagination context.
Matches account/location patterns.
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
WHY
Resolves #18335
Summary by CodeRabbit
New Features
Chores