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

[BUG] Exception when property of patched_fig is viewed #2512

Closed
luggie opened this issue Apr 24, 2023 · 3 comments · Fixed by #2513
Closed

[BUG] Exception when property of patched_fig is viewed #2512

luggie opened this issue Apr 24, 2023 · 3 comments · Fixed by #2513

Comments

@luggie
Copy link

luggie commented Apr 24, 2023

I know that it is currently not supported to view properties of patch_fig=Patch() but when e.g. iterating over trace names like so:

 for trace in patched_fig['data']:
        print(trace['name'])

no exception or error message is thrown but an endless stream of

...
<dash._patch.Patch object at 0x7f3b89a89b80>
<dash._patch.Patch object at 0x7f3b8305c0a0>
<dash._patch.Patch object at 0x7f3b89a89b80>
<dash._patch.Patch object at 0x7f3b8305c0a0>
<dash._patch.Patch object at 0x7f3b89a89b80>
<dash._patch.Patch object at 0x7f3b8305c0a0>
...

This is not exactly intended right?

I got there by trying to delete a trace of patched_fig by its name which otherwise appears not be possible (or is it?)

@alexcjohnson
Copy link
Collaborator

Right, you can’t read from the prop this way, only write. We do have an open issue somewhere to support the kind of query-targeted updates you’re suggesting but it hasn’t been worked on yet.

I suppose we could override __repr__ for Patch objects to describe that you can’t read from them, would that help?

@T4rk1n
Copy link
Contributor

T4rk1n commented Apr 24, 2023

This create an infinite loop, should implement __iter__ to raise an error.

@T4rk1n T4rk1n changed the title [Feature Request] Exception when property of patched_fig is viewed [BUG] Exception when property of patched_fig is viewed Apr 24, 2023
@luggie
Copy link
Author

luggie commented Apr 24, 2023

Right, you can’t read from the prop this way, only write. We do have an open issue somewhere to support the kind of query-targeted updates you’re suggesting but it hasn’t been worked on yet.

I suppose we could override __repr__ for Patch objects to describe that you can’t read from them, would that help?

Yes that would help.
Which open issue do you mean? :)

T4rk1n added a commit that referenced this issue Apr 27, 2023
# Conflicts:
#	CHANGELOG.md
T4rk1n added a commit that referenced this issue May 19, 2023
# Conflicts:
#	CHANGELOG.md
T4rk1n added a commit that referenced this issue May 19, 2023
Raise error when iterating over patch objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants