This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7448d07 [bugfix] ignore history.pushState errors (#5905)
7448d07 is described below
commit 7448d07e547b413b581ef1e2cbd5ddc27c66af92
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Tue Sep 18 21:52:30 2018 -0700
[bugfix] ignore history.pushState errors (#5905)
Ignoring history.pushState handling errors as they are impredictable and
crash the application hard.
I'm thinking this may be because the payload object is too big and the
browser is unhappy about it. I'm not sure if the payload/state is ever
used (when hitting back?). The error seem to stop when replacing payload
by an empty object.
---
.../assets/src/explore/components/ExploreViewContainer.jsx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/superset/assets/src/explore/components/ExploreViewContainer.jsx
b/superset/assets/src/explore/components/ExploreViewContainer.jsx
index 720e721..2476615 100644
--- a/superset/assets/src/explore/components/ExploreViewContainer.jsx
+++ b/superset/assets/src/explore/components/ExploreViewContainer.jsx
@@ -170,10 +170,15 @@ class ExploreViewContainer extends React.Component {
addHistory({ isReplace = false, title }) {
const { payload } = getExploreUrlAndPayload({ formData:
this.props.form_data });
const longUrl = getExploreLongUrl(this.props.form_data);
- if (isReplace) {
- history.replaceState(payload, title, longUrl);
- } else {
- history.pushState(payload, title, longUrl);
+ try {
+ if (isReplace) {
+ history.replaceState(payload, title, longUrl);
+ } else {
+ history.pushState(payload, title, longUrl);
+ }
+ } catch (e) {
+ // eslint-disable-next-line no-console
+ console.warn('Failed at altering browser history', payload, title,
longUrl);
}
// it seems some browsers don't support pushState title attribute