Skip to content

Commit 0888fb0

Browse files
fix: [UIE-9656] - Plans panel pagination bug fix (#13100)
* fix: [UIE-9659] Plans panel pagination bug fix * fix: [UIE-9659] adding changeset
1 parent 70589db commit 0888fb0

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Plans panel pagination bug fix ([#13100](https://github.com/linode/manager/pull/13100))

packages/manager/src/components/Paginate.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ interface State {
3939
interface Props<T> {
4040
children: (p: PaginationProps<T>) => React.ReactNode;
4141
data: T[];
42+
/**
43+
* When true, prevents page size changes from being persisted to the global PAGE_SIZE
44+
* localStorage key. This is critical for components with custom page size options
45+
* (e.g., plans panel with 15, 25, 50) to ensure they don't override the standard
46+
* page size preference (25, 50, 75, 100) used by other tables across the application.
47+
*
48+
* Use this flag when:
49+
* - Component has non-standard page size options (anything other than 25, 50, 75, 100)
50+
* - Page size should be ephemeral (not persisted across sessions)
51+
* - Component uses customOptions prop in PaginationFooter
52+
*
53+
* @default false
54+
*/
55+
noPageSizeOverride?: boolean;
4256
page?: number;
4357
pageSize?: number;
4458
pageSizeSetter?: (v: number) => void;
@@ -69,9 +83,13 @@ export default class Paginate<T> extends React.Component<Props<T>, State> {
6983
// Use the custom setter if one has been supplied.
7084
if (this.props.pageSizeSetter) {
7185
this.props.pageSizeSetter(pageSize);
72-
} else {
86+
} else if (!this.props.noPageSizeOverride) {
87+
// Only persist to global PAGE_SIZE storage if noPageSizeOverride is not set.
88+
// This ensures components with non-standard page sizes (e.g., 15, 25, 50)
89+
// don't override the standard preference (25, 50, 75, 100) used across the app.
7390
storage.pageSize.set(pageSize);
7491
}
92+
// If noPageSizeOverride is true, page size change is kept in local state only
7593
};
7694

7795
render() {

packages/manager/src/features/Kubernetes/KubernetesPlansPanel/KubernetesPlanContainer.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,17 @@ export const KubernetesPlanContainer = (
202202

203203
// Pagination enabled: use new paginated rendering
204204
return (
205-
<Paginate data={plans} key={paginationPrefix} shouldScroll={false}>
205+
<Paginate
206+
data={plans}
207+
key={paginationPrefix}
208+
// Prevent Kubernetes plans panel page size changes from being persisted to global PAGE_SIZE storage.
209+
// Kubernetes plans panel uses custom page size options (15, 25, 50) which should not override
210+
// the standard page size preference (25, 50, 75, 100) used by other tables.
211+
noPageSizeOverride={true}
212+
// Set default page size to 15 (first option in PLAN_PANEL_PAGE_SIZE_OPTIONS)
213+
pageSize={PLAN_PANEL_PAGE_SIZE_OPTIONS[0].value}
214+
shouldScroll={false}
215+
>
206216
{({
207217
count,
208218
data: paginatedPlans,

packages/manager/src/features/components/PlansPanel/PlanContainer.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,17 @@ export const PlanContainer = (props: PlanContainerProps) => {
253253

254254
// Pagination enabled: use new paginated rendering
255255
return (
256-
<Paginate data={plans} key={paginationPrefix} shouldScroll={false}>
256+
<Paginate
257+
data={plans}
258+
key={paginationPrefix}
259+
// Prevent plans panel page size changes from being persisted to global PAGE_SIZE storage.
260+
// Plans panel uses custom page size options (15, 25, 50) which should not override
261+
// the standard page size preference (25, 50, 75, 100) used by other tables.
262+
noPageSizeOverride={true}
263+
// Set default page size to 15 (first option in PLAN_PANEL_PAGE_SIZE_OPTIONS)
264+
pageSize={PLAN_PANEL_PAGE_SIZE_OPTIONS[0].value}
265+
shouldScroll={false}
266+
>
257267
{({
258268
count,
259269
data: paginatedPlans,

0 commit comments

Comments
 (0)