observablehq / observablehq/plot

The pointer interaction shouldn’t synchronously dispatch an event on initial render

Open
#2,160 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

The pointer interaction calls render(null) on the initial render, which I believe calls through to context.dispatchValue, resulting in a figure.dispatchEvent before the generated figure has even been returned. There’s no need to dispatch an event during the initial render, since it’s not possible for external listeners to be registered yet. Avoiding this call would address some compatibility issues in non-browser environments.

Ref. https://github.com/observablehq/plot/discussions/2158#discussioncomment-10512970

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the pointer interaction's initial render path and inspect how render(null) reaches context.dispatchValue and figure.dispatchEvent. Done means the initial render no longer dispatches an event before the generated figure is returned, while later pointer interactions still dispatch as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.