fix(dashboard): proxy modal stops pre-filling new scopes with an unrelated proxy - #4312
Merged
Merged
Conversation
…lated proxy The proxy assignments list returned by /api/settings/proxies/assignments is global, so its first entry belongs to some other scope. ProxyConfigModal picked `items.find(matchingScope) || items[0]`, so opening the proxy config for a freshly created provider/key (which has no assignment of its own) fell back to items[0] and pre-filled host/port/user/password from an unrelated proxy plus set hasOwnProxy=true — users reported a new provider already carried a proxy they never configured. Extracted the scope helpers into proxyAssignment.ts and added selectScopeAssignment which returns null (never items[0]) when the current scope has no assignment. The modal then shows the empty/custom state for new scopes. Both call sites now use it. TDD: src/shared/components/proxyAssignment.test.tsx (no-match -> null red->green for provider/key/global scopes; matching-scope + empty-list regression guards). Existing ProxyConfigModal component test stays green.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…lated proxy (diegosouzapw#4312) The proxy assignments list returned by /api/settings/proxies/assignments is global, so its first entry belongs to some other scope. ProxyConfigModal picked `items.find(matchingScope) || items[0]`, so opening the proxy config for a freshly created provider/key (which has no assignment of its own) fell back to items[0] and pre-filled host/port/user/password from an unrelated proxy plus set hasOwnProxy=true — users reported a new provider already carried a proxy they never configured. Extracted the scope helpers into proxyAssignment.ts and added selectScopeAssignment which returns null (never items[0]) when the current scope has no assignment. The modal then shows the empty/custom state for new scopes. Both call sites now use it. TDD: src/shared/components/proxyAssignment.test.tsx (no-match -> null red->green for provider/key/global scopes; matching-scope + empty-list regression guards). Existing ProxyConfigModal component test stays green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Causa
/api/settings/proxies/assignmentsreturns the global list of proxy assignments, so its first element belongs to some other scope (e.g. another account's proxy).ProxyConfigModalresolved the assignment for the current scope with:When the modal opened for a freshly created provider/key (no assignment of its own),
findreturnedundefinedand the|| items[0]fallback pre-selected an unrelated proxy: it setselectedProxyId, flippedhasOwnProxy = true, and pre-filled host/port/username/password. Users reported "when I create a new provider it already comes with a proxy I never configured." (Reproduced against a real instance whose only assignment was a per-key SOCKS5 proxy — every new provider inherited it.)Fix
Extracted the scope helpers into
src/shared/components/proxyAssignment.tsand addedselectScopeAssignment, which returnsnull(neveritems[0]) when the current scope owns no assignment. Both call sites (fetchAssignmentForScopeand the modal's load effect) now use it, so a new scope shows the empty/custom state instead of borrowing another scope's proxy.The extraction also keeps
ProxyConfigModal.tsxunder the 800-line file-size cap.TDD (red → green)
src/shared/components/proxyAssignment.test.tsx(runs in the blockingtest:vitestsuite):nullfor provider, account/key, and global-vs-provider scopes (previously returneditems[0])nullValidation: new test 5/5; existing
ProxyConfigModalcomponent test 3/3; related proxy unit tests 14/14;typecheck:coreclean;eslint0 errors;check:file-sizeOK.Origem
Reported on the mesh (escalated backlog): "quando eu crio um novo provider, ele já vem [com um proxy], isso tá vindo de onde? eu não configurei nenhum proxy aqui."