Skip to content

Commit 85b955d

Browse files
authored
Merge pull request #2035 from plotly/fix-debugger-html
Fix debugger html
2 parents c3b19b3 + 773ad67 commit 85b955d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2626

2727
- [#1976](https://github.com/plotly/dash/pull/1976) Fix [#1962](https://github.com/plotly/dash/issues/1962) in which DatePickerSingle and DatePickerRange are extremely slow when provided a long list of disabled_days.
2828

29+
- [#2035](https://github.com/plotly/dash/pull/2035) Fix [#2033](https://github.com/plotly/dash/issues/2033) In-App error reporting does not render HTML.
30+
2931
### Changed
3032

3133
- [#2016](https://github.com/plotly/dash/pull/2016) Drop the 375px width from default percy_snapshot calls, keep only 1280px

dash/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ function UnconnectedErrorContent({error, base}) {
109109
</div>
110110
)}
111111
{/* Backend Error */}
112-
{typeof error.html !== 'string' ? null : error.html.indexOf(
113-
'<!DOCTYPE'
114-
) === 0 ? (
112+
{typeof error.html !== 'string' ? null : error.html
113+
.split()[0]
114+
.toLowerCase()
115+
.startsWith('<!doctype') ? (
115116
<div className='dash-be-error__st'>
116117
<div className='dash-backend-error'>
117118
{/* Embed werkzeug debugger in an iframe to prevent

dash/testing/browser.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import warnings
77
import percy
8+
import requests
89

910
from selenium import webdriver
1011
from selenium.webdriver.support import expected_conditions as EC
@@ -188,8 +189,14 @@ def percy_snapshot(
188189
"""
189190
)
190191

192+
try:
191193
self.percy_runner.snapshot(name=snapshot_name, widths=widths)
194+
except requests.HTTPError as err:
195+
# Ignore retries.
196+
if err.request.status_code != 400:
197+
raise err
192198

199+
if convert_canvases:
193200
self.driver.execute_script(
194201
"""
195202
const stash = window._canvasStash;
@@ -204,9 +211,6 @@ def percy_snapshot(
204211
"""
205212
)
206213

207-
else:
208-
self.percy_runner.snapshot(name=snapshot_name, widths=widths)
209-
210214
def take_snapshot(self, name):
211215
"""Hook method to take snapshot when a selenium test fails. The
212216
snapshot is placed under.

0 commit comments

Comments
 (0)