Skip to content
Discussion options

You must be logged in to vote

This happens because a @ft.component function is not a normal control factory. It must run while Flet's component renderer is reconciling a tree. SettingsView.__post_init__() is ordinary control construction, and in this example it is reached from the imperative route callback, so there is no current renderer; that is exactly what the exception is reporting.

For this particular example, the smallest fix is to make view_content a plain factory:

def view_content():
    return ft.Text("some settings...")

@ft.control
class SettingsView(ft.View):
    def __post_init__(self, *args, **kwargs):
        super().__post_init__(*args, **kwargs)
        self.route = "/settings"
        self.controls = [

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@una0213
Comment options

Answer selected by una0213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants