Skip to content

Fix : scope picker followups#3020

Merged
HarshMN2345 merged 4 commits intomainfrom
fix-000-scope-picker-followups
May 4, 2026
Merged

Fix : scope picker followups#3020
HarshMN2345 merged 4 commits intomainfrom
fix-000-scope-picker-followups

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.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 4, 2026

Greptile Summary

This PR fixes several follow-up issues in the scope picker: the filteredScopes logic is refactored so backup scopes coming from the API are no longer duplicated (previously they could appear both in their natural position and again after databases.write); the onMount merge order is corrected so API data takes precedence over local fallbacks; the scopeCatalog derivation is simplified since backup scopes are already present in filteredScopes for cloud; and the scope item UI is reworked so the description is inside the <label>, making the full text area a click target for the checkbox.

Confidence Score: 5/5

This PR is safe to merge — no P0 or P1 issues found.

All changes are correctness improvements: deduplication logic works as intended, the onMount priority flip is the right fix (API over local), and the UI label restructure properly addresses the previous accessibility concern. No regressions or logic errors identified.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte Refactors backup scope merging to deduplicate API-returned scopes, fixes label accessibility by wrapping description inside the label element, removes redundant category ordering enum, and simplifies scopeCatalog derivation.

Reviews (2): Last reviewed commit: "Make scope descriptions toggle checkboxe..." | Re-trigger Greptile

Comment on lines 100 to 104
const categories = $derived.by(() => {
const availableCategories = new Set(
filteredScopes.map((scope) => normalizeCategory(scope.category))
return Array.from(
new Set(filteredScopes.map((scope) => normalizeCategory(scope.category)))
);

return [
...categoryOrder.filter((category) => availableCategories.has(category)),
...Array.from(availableCategories).filter(
(category) => !categoryOrder.includes(category as Category)
)
];
});
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 Category ordering lost after removing categoryOrder

The removed Category enum and categoryOrder array enforced a deterministic display order (Project → Auth → Databases → Functions → Storage → Messaging → Sites → Domains → Other). The new $derived.by simply emits categories in whatever insertion order the filteredScopes Map iteration produces, which depends entirely on API response order. If the server returns scopes in a different sequence, categories will shuffle — producing an inconsistent UI across environments or API versions.

Copy link
Copy Markdown
Member Author

@HarshMN2345 HarshMN2345 May 4, 2026

Choose a reason for hiding this comment

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

@greptile its fine if coming from be

Comment thread src/routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte Outdated
@HarshMN2345 HarshMN2345 requested a review from Meldiron May 4, 2026 06:42
@HarshMN2345 HarshMN2345 merged commit 047ead3 into main May 4, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-000-scope-picker-followups branch May 4, 2026 07:54
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