-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Do not alter paths data when loading through d3js #7026
Conversation
@@ -271,7 +271,10 @@ export function NewPaths({ dashboardItemId = null, color = 'white' }: PathsProps | |||
|
|||
const svg = createCanvas(width, height) | |||
const sankey = createSankey(width, height) | |||
const { nodes, links } = sankey(paths) | |||
const { nodes, links } = sankey({ | |||
nodes: paths.nodes.map((d) => ({ ...d })), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking
Should we add in ...paths
as well to ensure that any other attributes that were considered and part of paths are also considered by sankey
. I have no idea if that's a likely scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the code in d3-sankey I'm pretty sure it's only node and links that are used by sankey
(We also explode paths the same way in the Old Paths.tsx
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sankey code here https://github.com/d3/d3-sankey/blob/master/src/sankey.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and our older usage here https://github.com/PostHog/posthog/blob/master/frontend/src/scenes/paths/Paths.jsx#L139
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Changes
closes #7021 and #6934
How did you test this code?
by running it locally and showing I can save the data with this fix in place