Skip to content

Commit a6f7a45

Browse files
committed
fix url restore regression when gradient uses double stops
1 parent 309fa20 commit a6f7a45

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/utils/stops.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ export function updateStops(stops) {
1313
else if (!stop._manual) {
1414
// Treat null/undefined as unset; 0 is a valid value and must be preserved
1515
const p1Unset = (stop.position1 == null) || (stop.auto != null && String(stop.position1) == String(stop.auto))
16-
const p2UnsetOrAuto = (stop.position2 == null) || (stop.auto != null && String(stop.position2) == String(stop.auto))
16+
const p2Unset = (stop.position2 == null)
1717

1818
// Only assign auto for position1 when it is unset or previously auto-managed
1919
if (p1Unset) stop.position1 = autoVal
2020

21-
// Only assign auto for position2 when it's unset or previously auto-managed.
22-
// Preserve any explicitly provided second position (e.g., from presets) to avoid regressions.
23-
if (p2UnsetOrAuto) stop.position2 = p1Unset ? autoVal : stop.position1
21+
// Only assign a second position when it is truly unset. Never override an existing value,
22+
// even if it equals the auto position, to preserve explicit spans from presets/URL restores.
23+
if (p2Unset) stop.position2 = p1Unset ? autoVal : stop.position1
2424
}
2525
// Clear the manual flag after one normalization pass so future edits behave normally
2626
if (stop._manual) delete stop._manual

0 commit comments

Comments
 (0)