Oleg Isonen
|
f52545a2e9
|
fix: Fix expression binding editing (#5811)
## Summary
Fix expression binding editing when changing assignment/comparison
operators in the binding editor.
## Changes
- Fix duplicate variable replacement in assignment expressions like
`system.origin = ...`
- Align assignment target handling across expression linting, identifier
collection, and transpilation
- Prevent executable transpilation from adding optional chaining to
assignment targets, avoiding invalid JS like `a?.b = c`
- Preserve CodeMirror selection when syncing external editor values so
the cursor does not jump to the beginning
- Add regression coverage for:
- `system.origin = ...` variable roundtrip
- direct, member, computed, nested, compound, and logical assignments
- destructuring assignment rejection
- executable assignment transpilation parse safety
- editor selection clamping
## Testing
- `pnpm --filter @webstudio-is/sdk exec vitest run
src/expression.test.ts`
- `pnpm --filter @webstudio-is/sdk exec tsc --noEmit`
- `pnpm --filter @webstudio-is/builder exec vitest run
app/shared/code-editor-base.test.ts app/shared/data-variables.test.tsx
app/builder/shared/expression-editor.test.ts
app/builder/shared/binding-popover.test.ts`
- `pnpm --filter @webstudio-is/builder exec tsc --noEmit`
- `git diff --check`
|
2026-06-11 23:35:11 +02:00 |
|