Skip to content
Discussion options

You must be logged in to vote

Ok, I see. When the selection changes, you're calling refresh(), but you also create a new instance of the refreshable UI:

list_of_contracts.refresh()
await list_of_contracts(company_id)

I recommend changing the list_of_contracts to accept contracts, so that it doesn't have to request the data itself. It should only contain the presentation logic:

@ui.refreshable
def list_of_contracts(contracts):
    for contract in contracts[::-1]:
        ...

The selection change handler can fetch the new contracts and refresh the UI:

    async def on_company_change():
        company_id = selected_company.value
        contracts = await CompanyContracts.filter(company_id=company_id)
        list_of_con…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@falkoschindler
Comment options

Answer selected by miccs0
@miccs0
Comment options

@falkoschindler
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants