Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Set Graph id to be optional #219

Merged
merged 8 commits into from
Sep 7, 2018
Merged

Set Graph id to be optional #219

merged 8 commits into from
Sep 7, 2018

Conversation

valentijnnieman
Copy link
Contributor

This sets the Graph's id prop to not be required, and defines a defaultProp value for it set to 'untitled-graph' so Plotly.js still works.

Default is now null but tried 'untitled-graph' too - no luck so far,
this renders an error when omitting id in Dash
@chriddyp
Copy link
Member

Nice! I believe that we'll need the graph ID to be dynamic so that users can embed multiple graphs. There are a few places in the plot code that require unique IDs, like:

 Plotly.Plots.resize(document.getElementById(this.props.id));

and

PlotMethod(id, figure.data, figure.layout, config)

@valentijnnieman
Copy link
Contributor Author

@chriddyp Yep, makes sense. So if the user defines more than one dcc.Graph without providing an id they will both have the defaultProp.id of 'untitled-graph'. Any suggestion of how to fix that? Create a random string?

@chriddyp
Copy link
Member

Any suggestion of how to fix that? Create a random string?

Yeah, I think that's what we'll have to do

@valentijnnieman valentijnnieman requested review from chriddyp, ned2 and bpostlethwaite and removed request for ned2 July 9, 2018 08:51
@@ -139,73 +139,6 @@
}
}
},
"src/components/Confirm.react.js": {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this getting nuked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it was added here 0be4e4c

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no Confirm component though - perhaps you triggered a build and had some uncommited code (like a src/components/Confirm.react.js file perhaps) and released the previous version, and now when I'm building, the data is getting nuked.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was called Confirm at first, but I renamed it to ConfirmDialog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, so that's probably what happened.

Copy link
Member

@bpostlethwaite bpostlethwaite left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Member

@chriddyp chriddyp left a comment

Choose a reason for hiding this comment

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

Looks good to me!

It's odd that the diff for the bundle was so huge, not sure why:
image

Could we also add a quick test that has two different graphs with different figures? No need to do any assertions, a screenshot would suffice

@valentijnnieman
Copy link
Contributor Author

@chriddyp Do you want to take a look at the Percy screenshot?

@chriddyp
Copy link
Member

@chriddyp Do you want to take a look at the Percy screenshot?

Woops, sorry I missed this. In the future, feel free to go in there and approve them yourselves :)

💃

@valentijnnieman valentijnnieman merged commit 96e54cc into master Sep 7, 2018
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the remove-graph-id branch September 25, 2019 10:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants