Skip to content

Handle null titles/empty channels in Tip#2275

Closed
matthewCmatt wants to merge 1 commit intoobservablehq:mainfrom
matthewCmatt:main
Closed

Handle null titles/empty channels in Tip#2275
matthewCmatt wants to merge 1 commit intoobservablehq:mainfrom
matthewCmatt:main

Conversation

@matthewCmatt
Copy link
Copy Markdown

Aims to fix #2274

This PR allows the render function of tooltips (Tip) to handle null values for a title.

See the issue linked above for steps to reproduce the issue and some more reasoning behind this PR.

@matthewCmatt
Copy link
Copy Markdown
Author

matthewCmatt commented Jan 31, 2025

To be clear, this MR allows null titles to render properly for tooltips, i.e. it renders an empty tooltip.

renderLine(that, {value: mark.clipLine(line)});
}
} else {
} else if (isIterable(lines)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we’d just want to check for nullish here instead:

Suggested change
} else if (isIterable(lines)) {
} else if (lines != null) {

If lines is not null or undefined, we don’t want to allow non-iterable values here; a non-nullish, non-iterable value should still be an error.

@mbostock mbostock mentioned this pull request Apr 5, 2026
@mbostock
Copy link
Copy Markdown
Member

mbostock commented Apr 5, 2026

I tested this in #2408; it fixes the crash but also isn’t exactly the desired behavior. Rather than rendering an empty tip, we should render no tip at all.

Screenshot 2026-04-05 at 6 22 44 PM

I also figured out how to test this by dispatching a synthetic pointermove event. Work will continue in #2408. Thank you for filing the issue and proposing a fix.

@mbostock mbostock closed this Apr 5, 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.

Uncaught TypeError when passing null to all mark titles

2 participants