Skip to content

Clarifying understanding of refreshable example #4385

Closed Answered by falkoschindler
BlankAdventure asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @BlankAdventure,

You're right, set_count will refresh its target container:

target.refreshable.refresh()

The ui.state is "preserved" because it isn't an element or object, but only a function to create or retrieve a value and a set function. By keeping track of the current index of state variables, it notices whether a new variable needs to be created or if it can return an existing one:

target = cast(RefreshableTarget, RefreshableTarget.current_target)
if target.next_index >= len(target.locals):
target.locals.append

Replies: 1 comment 1 reply

Comment options

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

Answer selected by BlankAdventure
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