Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle null values in graph viz #1680

Merged
merged 1 commit into from Feb 15, 2022

Conversation

OskarDamkjaer
Copy link
Contributor

We stringify all node property values except null, which causes crashes later on. This PR makes we handle null, and that the correct type hint show up as well. Preview at http://handle_null_properties.surge.sh, easiest way to trigger the crash is run call apoc.create.vNode(['stuff'], {id:5, blah:null}) and hover the created node.

Here's a screen shot of how it looks now:

CleanShot 2022-02-14 at 19 03 49

@@ -25,7 +25,9 @@ import { optionalToString } from 'services/utils'

const mapProperties = (_: any) => Object.assign({}, ...stringifyValues(_))
const stringifyValues = (obj: any) =>
Object.keys(obj).map(k => ({ [k]: optionalToString(obj[k]) }))
Object.keys(obj).map(k => ({
[k]: obj[k] === null ? 'null' : optionalToString(obj[k])
Copy link
Member

Choose a reason for hiding this comment

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

Might want to get rid of the optionalToString function as it's used only here. Not necessary though

@OskarDamkjaer OskarDamkjaer merged commit a840d4a into neo4j:master Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants