Skip to content

Feat/rbac#220

Merged
tenkus47 merged 23 commits into
devfrom
feat/rbac
Jun 8, 2026
Merged

Feat/rbac#220
tenkus47 merged 23 commits into
devfrom
feat/rbac

Conversation

@harshal-2304

Copy link
Copy Markdown
Member

Summary

Fixes a bug in the series plan search dropdown where infinite scroll caused repeated API calls when more than 10 plans matched. Replaces pagination with a single request capped at 10 results.

Problem

PlanSearchSelector used useInfiniteQuery with an intersection-observer sentinel at the bottom of the dropdown. When results exceeded one page, the sentinel stayed in view inside the scrollable area and kept calling fetchNextPage(), causing infinite requests to /api/v1/cms/plans.

Solution

  • Replace useInfiniteQuery with useQuery (one request per search)
  • Cap results at 10 plans (PAGE_SIZE = 10, skip: 0)
  • Remove intersection observer, sentinel element, and "Loading more..." UI
  • Remove unused react-intersection-observer import from this component

Changed files

  • src/components/routes/create-series/components/PlanSearchSelector.tsx

harshal-2304 and others added 23 commits June 3, 2026 12:42
Author groups — CMS UI, invites, notifications, and permissions
- Introduced new types for title search response and text search items in searchApi.ts.
- Updated searchTitles function to validate title length before making API calls.
- Refactored MobileView component to conditionally render based on plan publication status and improved iframe integration.
- Enhanced SourceSelectorSheet to enforce minimum title search length and provide user feedback for insufficient input.
- Refactored fetchTextDetails function in searchApi.ts to encapsulate query parameters within a params object for improved clarity and maintainability.
… related components

- Enhanced the formatting of the searchTitles function in searchApi.ts for better readability.
- Adjusted the Chinese language label in dashboardTableUi.tsx for consistent indentation.
- Updated MobilePreviewSplitDivider.tsx to streamline button attributes.
- Refactored SourceSelectorSheet.tsx to improve the clarity of the sources memoization logic.
- integrated Tolgee for improved language handling in dashboard components
- updated displayDashboardItemTitle to accept localeLanguage for localized titles
- modified mapDashboardItemToTableRow to utilize localeLanguage
- added tests to verify title selection based on current UI locale
- streamlined metadata title selection logic for better fallback handling
feat(dashboard): enhance localization support for dashboard item titles
- add platform access helpers, content permissions, and dashboard row role resolution
- gate auth for verify email, inactive authors, and creator group onboarding
- add content transfer API with CMS payload normalization, dialog, and group UI
- add admin authors page and staff navigation for platform role management
- wire group-scoped plan/series routes, group content section, and transfer ownership flows
- add dashboard group filter with membership vs staff-wide group lists
- hide CMS actions and block plan routes for reviewers; read-only tags and group invites
- relax eslint for legacy any usage and ignore generated coverage output
- import DashboardTableRow from dashboardTable instead of dashboardApi
- cast test translate mock to Tolgee TFnType so DashboardContentTable tests compile
- updated dashboard group filter to utilize user info for fetching accessible groups
- replaced deprecated group filter logic with a new useEffect for group ID validation
- improved group label handling in the dashboard component
- modified API calls to use 'for_dashboard' parameter for role-based group access
- added tests to ensure correct API behavior for different user roles
- add resolveDashboardItemImageUrl for image_url, plan_image_url, and nested image sizes
- map dashboard and legacy table rows through the shared image resolver
- show group avatars in the groups list via resolveGroupAvatarUrl
- add tests for nested image objects and series cover mapping
- drop unused platformAccess type import from groups API
- fix lint unused-vars error in groupsApi
- map series plan rows through resolveDashboardItemImageUrl for nested image fields
- extend SeriesPlanDTO with plan_image_url and image variant shapes
- add test coverage for nested image.medium resolution
- remove unused Button import from dashboard page
Platform RBAC, content transfers, and reviewer-safe CMS
- replace useInfiniteQuery with useQuery for single-page plan search
- limit each search to 10 plans instead of paginating with load more
- remove intersection observer sentinel that triggered repeated API fetches
@harshal-2304 harshal-2304 requested a review from tenkus47 June 8, 2026 06:29
@harshal-2304 harshal-2304 self-assigned this Jun 8, 2026
@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to one component and correctly fixes the runaway fetchNextPage loop.

The refactor is small and focused: a single query hook replaces the infinite-query setup, the data accessor is updated correctly, and all removed code (sentinel div, IntersectionObserver, pagination state) had no side effects elsewhere. The 'Searching…' loading state still works because a changed query key resets isLoading to true. The only deliberate trade-off — capping results at 10 — is acknowledged in the PR description and is acceptable for a search-as-you-type selector.

No files require special attention.

Reviews (1): Last reviewed commit: "Merge branch 'dev' of github-dharmaduta:..." | Re-trigger Greptile

@tenkus47 tenkus47 merged commit 892b575 into dev Jun 8, 2026
3 checks passed
@tenkus47 tenkus47 deleted the feat/rbac branch June 8, 2026 07:21
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.

2 participants