Skip to content

fix: preserve visible state in state consumer#11

Open
Des1ynY wants to merge 1 commit intoPlugFox:masterfrom
Des1ynY:master
Open

fix: preserve visible state in state consumer#11
Des1ynY wants to merge 1 commit intoPlugFox:masterfrom
Des1ynY:master

Conversation

@Des1ynY
Copy link

@Des1ynY Des1ynY commented Feb 13, 2026

Bug description: StateConsumer dropped visible state when rebuilding from outer scope.

Why happened: StateConsumer utilized _controller.state property. buildWhen method prevents rebuilding widget internally, so when StateConsumer is isolated everything works well and visible state is preserved. But any rebuild from outer scope (setState, ListenableBuilder, etc.) that will trigger StateConsumer rebuild, will cause visible state loss in favor of current controller state.

Fix: cache visible state in _StateConsumerState and use it in builder

IDK if it was by design but caused some troubles in our project. Highly appreciate your work, we're migrating from bloc to control and it's doing great job. Thank you)

@Des1ynY Des1ynY changed the title fix: reserve visible state in state consumer fix: preserve visible state in state consumer Feb 13, 2026
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 this pull request may close these issues.

1 participant