Skip to content

Append popup-added conditions to the end of switch rules#332

Open
galaxy-sea wants to merge 1 commit into
zero-peak:masterfrom
galaxy-sea:master
Open

Append popup-added conditions to the end of switch rules#332
galaxy-sea wants to merge 1 commit into
zero-peak:masterfrom
galaxy-sea:master

Conversation

@galaxy-sea

Copy link
Copy Markdown

What does this PR do?

  • Bug fix
  • Improvement
  • New feature

This PR updates popup-added switch rules so they are appended to the end of the rule list instead of being inserted at the top.

Switch rules are matched from top to bottom, so newly added broader conditions should not take priority over existing, more specific rules.

Example:

  • Existing rule: *.gemini.google.com -> xxx
  • New popup-added rule: *.google.com -> yyy

If the new rule is inserted at the top, *.google.com can shadow the existing *.gemini.google.com rule. Appending popup-added rules to the bottom preserves the priority of existing rules while still adding the new condition.

Implementation details:

  • Adds an optional addToBottom parameter to Options#addCondition.
  • Keeps the existing -addConditionsToBottom option as the default behavior for callers that do not pass the new parameter.
  • Passes addToBottom = true from popup condition entry points:
    • normal popup “Add condition”
    • request error domain list “Add condition”
    • network request detail “Add condition”

Compatibility

This PR is compatible with old versions. Users can upgrade normally.

There are no data format or migration changes. The only UX behavior change is that conditions added from popup entry points are now appended to the bottom of the switch rule list, preserving existing rule priority. Other callers keep the previous default behavior.

Screenshots (if applicable)

image

Not applicable.

Add an optional addToBottom parameter to addCondition and pass it from popup condition entry points so rules added from the popup are appended instead of prepended. Preserve the existing default behavior for other callers.
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.

1 participant