Skip to content

Plots.resize returns a Promise #253

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

Merged
merged 2 commits into from
Feb 17, 2016
Merged

Conversation

aleburato
Copy link
Contributor

As the resize operation will modify the size of the plot only after a
timeout, if you call resize and then immediately do something based on
the current plot size, you'll get the "old" size. This fixes it.

As the resize operation will modify the size of the plot only after a
timeout, if you call resize and then immediately do something based on
the current plot size, you'll get the "old" size. This fixes it.
@etpinard
Copy link
Contributor

Thanks for the PR. Nice find! 🍻

A few things will need to happen before we merge this in:

@aleburato
Copy link
Contributor Author

Heh! I'm so new to this (I mean git, not Javascript or developing in general).

I didn't notice the style guides, and unfortunately I created the pull request just before leaving the office. I'll edit the code to make it compliant to the style guide and submit a new pull request. Is it OK?

@etpinard
Copy link
Contributor

You can simply push new commits to your promise-from-resize branch and these commits will automatically show up in this PR.

@aleburato
Copy link
Contributor Author

Done. One last question: I have installed eslint in my editor (VS Code) and it correctly picks up plotly's .eslintrc. However, it complains about "Promise" not being defined (see: http://eslint.org/docs/rules/no-undef).
Adding a */global Promise*/comment in the plots.js file fixes the warning, but I guess that if you didn't do that already (and npm run lint is not complaining either), I'm missing something.

@etpinard
Copy link
Contributor

I have installed eslint in my editor

You must be running version 2.0.x of eslint through your editor. Looks like they cleaned up some of their namespacings in v2.0.0 (see here). plotly.js is still using v1.x.x. to run npm run lint explaining the discrepancy.

So, don't worry about Promise warnings, we'll clean those up soon.

Your PR looks good, it's missing some tests though. Are you interested in adding some tests in https://github.com/plotly/plotly.js/blob/master/test/jasmine/tests/plot_promise_test.js ? If not, we'll take care of it.

@aleburato
Copy link
Contributor Author

As this is my first time I'd prefer you to go ahead with the tests, so that i can see how it's done. Thanks!

@mdtusz
Copy link
Contributor

mdtusz commented Feb 17, 2016

We'll merge this in then apply some tests on top. Thanks for the contribution!

mdtusz added a commit that referenced this pull request Feb 17, 2016
@mdtusz mdtusz merged commit 8b6344b into plotly:master Feb 17, 2016
@mdtusz mdtusz mentioned this pull request Feb 17, 2016
@aleburato aleburato deleted the promise-from-resize branch January 5, 2017 11:31
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.

3 participants