Skip to content

fix: properties not updating correctly without refresh#11857

Merged
kgryte merged 6 commits intostdlib-js:refactor/plotfrom
gururaj1512:bug-2
May 4, 2026
Merged

fix: properties not updating correctly without refresh#11857
kgryte merged 6 commits intostdlib-js:refactor/plotfrom
gururaj1512:bug-2

Conversation

@gururaj1512
Copy link
Copy Markdown
Member

Resolves None

Description

What is the purpose of this pull request?

This pull request:

  • fix: properties not updating correctly without refresh

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • None

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

I used GitHub Copilot to help trace the bug through the codebase & reading through router.js, on_change.js, and the route handlers to understand how the request flow worked. Once I understood the root cause, I identified the fixes myself and authored the changes manually. The AI mostly helped me navigate unfamiliar parts of the codebase faster.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 30, 2026
@gururaj1512
Copy link
Copy Markdown
Member Author

gururaj1512 commented Apr 30, 2026

change 1: 400 Bad Request on domainColor, domainDash, etc.

When I tried updating these from the side panel, I kept getting a 400. Tracing it, I found parameterize() in router.js builds regexes without ^/$ anchors, so a POST to /config/axes/0/domainColor was matching the /domain route instead. Since routes are registered alphabetically, axesDomain comes first and its toBoolean transformer choked on values like "#ff0000". Fixed by anchoring the regex:

re = '^' + re + '$';

Bug 2: domainDash changes only reflected after a page refresh

Even after fixing the 400, domainDash updates weren't live. Lil-GUI can't handle arrays natively, so array properties get stringified (e.g. "[5, 5]"). The raw string was being passed directly to state.view.onSignal(), which Vega couldn't interpret. The backend was fine since it parses via toJSON — the mismatch was purely on the frontend signal side. Fixed by parsing the value back before emitting the change event in on_change.js, while keeping the raw string for the server POST:

var val = event.value;
if ( isJSON(val) ) {
    try { val = JSON.parse( val ); } catch ( err ) {}
}

All properties now seem to update correctly.

Signed-off-by: Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com>
Comment thread lib/node_modules/@stdlib/plot/base/view/lib/browser/app/editor/on_change.js Outdated
@kgryte kgryte removed the Needs Review A pull request which needs code review. label May 3, 2026
@kgryte kgryte added Needs Discussion Needs further discussion. and removed Needs Discussion Needs further discussion. labels May 3, 2026
Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kgryte
Copy link
Copy Markdown
Member

kgryte commented May 4, 2026

As the CI failure is expected, I'll go ahead and merge.

@kgryte kgryte merged commit 20cbfba into stdlib-js:refactor/plot May 4, 2026
28 of 30 checks passed
@kgryte kgryte added gsoc: 2026 Google Summer of Code (2026). and removed gsoc: 2026 Google Summer of Code (2026). labels May 4, 2026
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.

3 participants