Skip to content

A wrapper component for debugging #899

Answered by rmorshea
numpde asked this question in Question
Discussion options

You must be logged in to vote

For this to be transparent you just need to ensure two things:

  1. no conditionally declared state
  2. the old view is forced to unmount after an error

You can ensure 1 by declaring the "error" view in a separate component to isolate any state it might have. You can fulfill 2 by either returning elements with different keys, or components of different "types" where two components may be said to have the differing types if they came from distinct functions. Here's an example that implements this

from idom import component

class safe_component:
    def __init__(self, render_view):
        self.render_view = render_view
        self.render_error = None

    @component
    def __call__(self, *args, 

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rmorshea
Comment options

@numpde
Comment options

Answer selected by numpde
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants