idom-team / idom-dash

A custom component for Plotly Dash that uses IDOM
Other
17 stars 1 forks source link

AttributeError: 'LayoutUpdate' object has no attribute 'patch' #1

Closed sylvoslee closed 3 years ago

sylvoslee commented 3 years ago

Traceback (most recent call last): File "E:\idom\idom_plotly_dash\constructor.py", line 33, in update_loop return get_update() File "E:\idom\idom_plotly_dash\constructor.py", line 78, in get_update return {"pathPrefix": update.path, "patch": update.patch} AttributeError: 'LayoutUpdate' object has no attribute 'patch'

rmorshea commented 3 years ago

Thanks for posting an issue! This repo's still in the early stages of development at the moment. I'll try to post a fix soon.

rmorshea commented 3 years ago

So this might actually take a little bit to fix. IDOM requires the ability to push updates to the client and unfortunately Plotly just doesn't support that at the moment. I'm going to have to develop a Flask server extension for IDOM so I can create a websocket connection to set up a pub/sub model for the component.

sylvoslee commented 3 years ago

https://github.com/thedirtyfew/dash-extensions

Whether the WebSocket component can provide ideas for you, and look forward to dash integration idom

rmorshea commented 3 years ago

Thanks! Will take a look. For now I've pushed a few changes that kind of get it working however without a websocket some events just don't trigger client updates.

rmorshea commented 3 years ago

I'm also noticing that setProps doesn't always seem to be pushing events to the server. Not that this will matter when there's a websocket involved, but if you happen to know anything about that I'd be curious understand why.

Here's a GIF I recorded showing that events are produced on every click, but only get sent (and the count on the button updated) after I move the mouse a bit before clicking next time. I verified that setProps is the problem by logging the events server-side and checking that they were not received:

failed-changes

You can run this for yourself in usage.py now if you want to investigate.