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

undefined is not a constructor error in safari and firefox #56

Open
serhii-havrylov opened this issue Apr 28, 2021 · 2 comments
Open

undefined is not a constructor error in safari and firefox #56

serhii-havrylov opened this issue Apr 28, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@serhii-havrylov
Copy link

serhii-havrylov commented Apr 28, 2021

The following code produces undefined is not a constructor (evaluating 'new window.ResizeObserver(_this.resizeHandler)') error in safari and firefox browsers, however it works normally in google chrome.

import dash
import dash_core_components as dcc
import dash_extendable_graph as deg
import dash_html_components as html
import plotly.express as px
import plotly.graph_objects as go
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate


if __name__ == "__main__":
    app = dash.Dash()
    layout = [deg.ExtendableGraph(id="graph", figure=px.scatter(),
                                  style={"height": "75vh"}),
              dcc.Interval(id="ms-beat",
                           interval=1000,
                           n_intervals=0)
              ]
    app.layout = html.Div(children=layout)
    flag = False

    @app.callback(Output("graph", "figure"),
                  Input("ms-beat", "n_intervals"),
                  State("graph", "figure"))
    def add_level_lines(n_intervals, figure):
        global flag
        if flag:
            raise PreventUpdate
        flag = True
        figure = go.Figure(figure)
        figure.add_hline(y=24, line_dash="dot", annotation_text="label")
        figure.update_layout(autosize=True)
        return figure

    app.run_server(debug=True)
    # app.run_server()

exception details:

undefined is not a constructor (evaluating 'new window.ResizeObserver(_this.resizeHandler)')

(This error originated from the built-in JavaScript code that runs Dash apps. Click to see the full stack trace or open your browser's console.)
ResizeDetector

constructClassInstance@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:13015:28

updateClassComponent@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:17235:29

callCallback@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:182:21

dispatchEvent@[native code]

invokeGuardedCallbackDev@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:231:31

invokeGuardedCallback@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:286:38

beginWork$1@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:23338:30

performUnitOfWork@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:22292:25

workLoopSync@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:22265:41

performSyncWorkOnRoot@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:21891:23

performSyncWorkOnRoot@[native code]

http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:11224:34

unstable_runWithPriority@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react@16.v1_9_1m1617985068.14.0.js:2685:26

flushSyncCallbackQueueImpl@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:11219:26

flushSyncCallbackQueue@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:11207:31

flushPassiveEffectsImpl@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:23018:27

unstable_runWithPriority@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react@16.v1_9_1m1617985068.14.0.js:2685:26

http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react-dom@16.v1_9_1m1617985068.14.0.js:22834:32

workLoop@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react@16.v1_9_1m1617985068.14.0.js:2629:44

flushWork@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react@16.v1_9_1m1617985068.14.0.js:2584:26

performWorkUntilDeadline@http://127.0.0.1:8050/_dash-component-suites/dash_renderer/react@16.v1_9_1m1617985068.14.0.js:2196:50
@bcliang bcliang self-assigned this May 1, 2021
@bcliang bcliang added the bug Something isn't working label May 1, 2021
@bcliang
Copy link
Owner

bcliang commented May 1, 2021

I wasn't able to replicate the bug report using firefox v88, but the provided error suggests that react-resize-detector wasn't bundled properly with the component. That shouldn't be the case (particularly with app.run_server(debug=True)), but it's possible I messed something up in the build.

@serhii-havrylov Are you building from source or installing from pypi? Can you provide pip list output for dash-related packages (dash, dash-core-components, dash-extendable-graph)?

I will make an update to package.json (moving react-resize-detector into dependencies section) in case there are some particularities, but that would theoretically only affect the minimized bundle. Locally, I haven't observed a change on the compiled dash_extendable_graph.dev.js

@serhii-havrylov
Copy link
Author

Hi

Thank you for your reply. I've installed it from pypi:

Package                  Version
------------------------ -------------------
dash                     1.20.0
dash-core-components     1.16.0
dash-extendable-graph    1.3.0
dash-html-components     1.1.3
dash-renderer            1.9.1
dash-table               4.11.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants