Skip to content

Web UI: fix JS SyntaxError that stopped the whole page from running - #17

Merged
fernandogarzaaa merged 2 commits into
mainfrom
fix/web-ui-js-syntax
Oct 13, 2026
Merged

fernandogarzaaa merged 2 commits into
mainfrom
fix/web-ui-js-syntax

Conversation

@fernandogarzaaa

Copy link
Copy Markdown
Owner

Problem

The built-in Web UI (opendrop serve, then open /) did nothing at all. Loading it headless in Chromium showed PAGEERR Invalid or unexpected token: the model list never loaded, the hardware badge stayed on "Loading hardware…", and Send/Pull were inert.

Root cause: _WEB_UI in opendrop/ui/web.py is a normal (non-raw) triple-quoted Python string, so the two buf.split(' ') / chunk.split(' ') calls are served with a literal newline inside a JS string literal. node --check on the served script: SyntaxError: Invalid or unexpected token at line 120. The check in #16 ran against the source text, not the rendered page, so it missed this.

Fix

_WEB_UI = r"""...""". Those two are the only backslashes in the template, so nothing else changes.

Evidence

  • Headless Chromium, desktop 1280px and mobile 390px, after the fix: no page errors, "No models yet. Pull one above." and "No GPU / CPU only · 3.6 GB" render, no horizontal overflow. (Only remaining console error is /favicon.ico 404.)
  • New tests/test_web_ui.py: checks the escape survives and runs node --check on the served script (skipped if node is absent). Both fail on main, pass here. Full suite: 180 passed.

No version bump/release: publish.yml publishes to PyPI as opendrop, a name owned by another project (owner decision pending).

The embedded page was a non-raw Python string, so split('\n') rendered as a
real newline inside a JS string literal. Make it a raw string and test that
the served script parses.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1b3acfb8-6e92-4049-beff-b723bf6c78c8
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread tests/test_web_ui.py Fixed
@fernandogarzaaa
fernandogarzaaa merged commit bf4f681 into main Oct 13, 2026
9 checks passed
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.

2 participants