Skip to content

Patch: variable count display#3040

Merged
HarshMN2345 merged 2 commits into
mainfrom
codex/fix-variable-count-from-response-items
May 12, 2026
Merged

Patch: variable count display#3040
HarshMN2345 merged 2 commits into
mainfrom
codex/fix-variable-count-from-response-items

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 eldadfux May 11, 2026 20:03
@HarshMN2345 HarshMN2345 changed the title Fix: variable count display Patch: variable count display May 11, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 11, 2026

Greptile Summary

This patch introduces a variableCount reactive variable to fix the variable count display, using variableList.total for backend-paginated views and variableList.variables.length for client-side views. It also updates related guards and reactive statements to use array length comparisons instead of .total field comparisons.

  • variableCount fix: The new reactive variable correctly distinguishes between backend-paginated lists (where variableList.variables is only the current page) and fully-loaded client-side lists, fixing an inaccurate display count.
  • ensureAllVariablesLoaded guard: The early-return condition now compares fullVariableList.variables.length >= variableList.variables.length, but when backendPagination is true this compares against the current page size rather than the server total, so a stale partial fullVariableList can cause the raw editor and import modal to receive incomplete data.

Confidence Score: 3/5

The display-count fix is correct, but the updated early-return guard in ensureAllVariablesLoaded can cause the raw editor and import modal to open with an incomplete variable list when backend pagination is active.

The variableCount introduction correctly separates server-total from local-length for display, which is the stated goal. However, the guard condition in ensureAllVariablesLoaded now compares loaded variables against the current page's array length instead of the server's total count. When backend pagination is on and a stale fullVariableList carries any variables at all (e.g. from the allVariableList prop), 50 >= 10 passes and the editor/import flow silently operates on fewer variables than exist on the server, potentially causing overwrites or deletions of variables that appear missing.

src/routes/(console)/project-[region]-[project]/updateVariables.svelte — specifically the ensureAllVariablesLoaded guard and how fullVariableList is initialised from the allVariableList prop

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/updateVariables.svelte Fixes variable count display by introducing variableCount that uses variableList.total for backend-paginated views and variableList.variables.length for client-side views; also adjusts ensureAllVariablesLoaded and the stale-list reactive statement to compare array lengths instead of .total fields.

Reviews (1): Last reviewed commit: "fix lint" | Re-trigger Greptile

Comment on lines 108 to +114
async function ensureAllVariablesLoaded() {
if (fullVariableList && fullVariableList.total === variableList.total) return;
if (
fullVariableList &&
fullVariableList.variables.length >= variableList.variables.length
) {
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 When backendPagination is true the raw editor and import modal both call ensureAllVariablesLoaded, which must load every variable regardless of the current page. The new guard fullVariableList.variables.length >= variableList.variables.length compares against the current page size (e.g. 10), not the server total. A stale fullVariableList with, say, 50 of 100 variables would satisfy 50 >= 10 and return early, leaving the editor with incomplete data. Comparing against variableList.total (the server total) correctly gates on whether all variables are present.

Suggested change
async function ensureAllVariablesLoaded() {
if (fullVariableList && fullVariableList.total === variableList.total) return;
if (
fullVariableList &&
fullVariableList.variables.length >= variableList.variables.length
) {
return;
}
async function ensureAllVariablesLoaded() {
if (
fullVariableList &&
fullVariableList.variables.length >= variableList.total
) {
return;
}

@HarshMN2345 HarshMN2345 merged commit f07b9fd into main May 12, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the codex/fix-variable-count-from-response-items branch May 12, 2026 04:37
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