Skip to content

[Core] Fix state dictionary keys in JavaScript updates - #1871

Open
UmutAlisoglu wants to merge 1 commit into
r0x0r:masterfrom
UmutAlisoglu:codex/state-dictionary-keys
Open

UmutAlisoglu wants to merge 1 commit into
r0x0r:masterfrom
UmutAlisoglu:codex/state-dictionary-keys

Conversation

@UmutAlisoglu

Copy link
Copy Markdown

Description

window.state['item-count'] = 420 updates Python state but leaves the JavaScript value undefined: the bridge inserts dictionary keys into dot-property expressions. Use JSON-quoted bracket access for assignment and deletion instead.

Adds one native regression test covering hyphens, spaces, quotes and backslashes. It fails on unchanged master and passes with this fix. No public API or dependency changes.

Affected backends

  • All / backend-agnostic (webview/state.py only)

Tested locally on Windows, Python 3.11.9, WinForms/EdgeChromium (WebView2). Other backends, including WinUI 3, are untested locally.

Checklist

  • Native state tests: 22 passed.
  • Full pytest suite via python tests/run.py: 181 passed, 5 skipped.
  • Pre-commit passes on all changed files.
  • pre-commit run --all-files passes: this Windows checkout has text placeholders for tracked symlinks, causing existing EOF/Ruff failures. Full Ruff lint and format pass excluding tests/android/shared, where the Python link placeholders reside; no exclusions were committed.
  • Entry added to docs/CHANGELOG.md.
  • API documentation/examples: no changes needed for this bug fix to existing dictionary access.

AI-assisted with OpenAI Codex; before/after reproduction and the test results above were run locally.

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