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

Fix display of stack traces within RStudio's viewer pane #996

Merged
merged 9 commits into from
Dec 9, 2019
Merged

Conversation

rpkyle
Copy link
Contributor

@rpkyle rpkyle commented Nov 4, 2019

This PR proposes to modify dash-renderer to check whether the stack trace being sent up by the backend includes the string <!DOCTYPE HTML. If it does, the content is embedded within an iframe to avoid CSS leaking caused by the Werkzeug HTML which Dash for Python provides.

If it does not, the content is included in a simple nested div instead, with customized CSS to properly line-wrap the preformatted content, and to automatically use a scrollbar if the stack trace is sufficiently long.

After merging, the stack trace within the dev tools UI for Dash for R apps will look like this:

Viewer Pane Screenshot

To be merged concurrently with plotly/dashR#137. Fixes #994.

@rpkyle rpkyle added the dash-renderer related to Dash renderer label Nov 4, 2019
@rpkyle rpkyle self-assigned this Nov 4, 2019
style={{
width: 'calc(600px - 67px)',
height: '75vh',
border: 'none',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we actually need any of these style attrs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept them because we used them previously, but it might be ok to 🔪 from both R and Python. The important bits are in the FrontEndError.css file anyhow.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The <iframe> needs explicit sizing because the containing page doesn't know what's in it, and border because perhaps iframes have a border by default. But the unframed string version should be closer to the front-end version, which gets most of its styling from .dash-fe-error__info.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in bf08944

…t.js

Co-Authored-By: alexcjohnson <johnson.alex.c@gmail.com>
@Marc-Andre-Rivet Marc-Andre-Rivet modified the milestones: Dash v1.7, Dash v1.8 Nov 27, 2019
@rpkyle rpkyle requested review from alexcjohnson and removed request for byronz December 4, 2019 18:00
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

Looks great! 💃

@rpkyle rpkyle merged commit 19fe714 into dev Dec 9, 2019
@rpkyle rpkyle deleted the 994-fix-viewer branch December 9, 2019 03:49
@rpkyle rpkyle restored the 994-fix-viewer branch December 24, 2019 19:32
@rpkyle rpkyle deleted the 994-fix-viewer branch December 25, 2019 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dash-renderer related to Dash renderer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stack traces do not render in the dev tools UI when using RStudio's viewer pane
3 participants