Skip to content

Fix variable settings pagination#3041

Merged
HarshMN2345 merged 2 commits into
mainfrom
fix-variable-backend-pagination
May 12, 2026
Merged

Fix variable settings pagination#3041
HarshMN2345 merged 2 commits into
mainfrom
fix-variable-backend-pagination

Conversation

@HarshMN2345
Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@HarshMN2345 HarshMN2345 requested a review from abnegate May 12, 2026 05:56
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR introduces backend-driven pagination for environment variables in function and site settings pages. Instead of navigating to a new URL on each page turn, the component now fetches the requested page directly via a new sdkListVariables prop, keeping the user on the current route.

  • updateVariables.svelte: adds pagedVariableList local state and reloadPageOnPagination prop; page-change handler fetches via sdkListVariables when reloadPageOnPagination=false; CRUD operations continue to call invalidate(Dependencies.VARIABLES) through the parent sdk*Variable functions, which correctly resets pagedVariableList to page 1.
  • +page.ts (functions & sites): initialises the variables query with PAGE_LIMIT=12 and offset=0, returning limit and variablesOffset to the page for prop binding.
  • +page.svelte (functions & sites): wires the new sdkListVariables, backendPagination, reloadPageOnPagination={false}, variablesOffset, and variablesLimit props to UpdateVariables.

Confidence Score: 5/5

Safe to merge; the pagination logic is correct and CRUD operations properly reset back to page 1 via the existing invalidation flow.

All changed code paths behave correctly: CRUD operations invalidate and reset state as expected, pagedVariableList is initialised and updated consistently, and the reloadPageOnPagination=false branch fetches the right page. The only findings are a redundant initial re-fetch in loadAllVariables and two orphaned module-level constants — neither affects correctness or user-visible behaviour.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/updateVariables.svelte Core change: adds pagedVariableList state and reloadPageOnPagination prop so page changes fetch directly via sdkListVariables instead of navigating; CRUD invalidation correctly resets to page 1; loadAllVariables unnecessarily re-fetches page 1 data when backendPagination=true.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/+page.svelte Wires up sdkListVariables, backendPagination, reloadPageOnPagination=false, variablesOffset, and variablesLimit props to the UpdateVariables component correctly.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/+page.ts Adds PAGE_LIMIT/offset=0 for function variables and a VARIABLES_LIMIT=100 constant for global variables; the module-level constant is used only once inline and diverges from PAGE_LIMIT without explanation.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.svelte Mirror of the functions settings page change; correctly wires all new props to UpdateVariables.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.ts Same pattern as the functions loader; carries the same unexplained VARIABLES_LIMIT=100 constant used only once.

Reviews (3): Last reviewed commit: "Merge main into variable pagination bran..." | Re-trigger Greptile

@HarshMN2345 HarshMN2345 force-pushed the fix-variable-backend-pagination branch from afe4e80 to b4d7dde Compare May 12, 2026 06:04
@HarshMN2345 HarshMN2345 force-pushed the fix-variable-backend-pagination branch from b4d7dde to e8cba9a Compare May 12, 2026 06:06
@HarshMN2345 HarshMN2345 requested a review from fogelito May 12, 2026 06:16
@HarshMN2345 HarshMN2345 merged commit 9b67920 into main May 12, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-variable-backend-pagination branch May 12, 2026 06: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