fix: auto-correct redirect target when switching type to scheme

When user changes redirect type from location/prefix to scheme, the
target field (e.g. "https://example.com") stays as-is but the UI shows
a blank Select. If saved without re-selecting, invalid config would be
sent. Now auto-sets target to "https" when switching to scheme type.

Made-with: Cursor
This commit is contained in:
taylanbakircioglu
2026-03-19 12:07:56 +03:00
parent 7105213ba5
commit bb6cb58db3
+7 -1
View File
@@ -538,7 +538,13 @@ function RedirectRuleCard({ rule, index, onChange, onDelete }) {
<Col flex="100px">
<Select
value={rule.type}
onChange={(val) => onChange(index, { ...rule, type: val })}
onChange={(val) => {
const newRule = { ...rule, type: val };
if (val === 'scheme' && rule.target !== 'http' && rule.target !== 'https') {
newRule.target = 'https';
}
onChange(index, newRule);
}}
placeholder="Type"
size="small"
style={{ width: '100%' }}