Skip to content

Fix image filtering#533

Merged
rteyssandier merged 2 commits into
openflocon:mainfrom
snappdevelopment:fix-image-filter
Jun 28, 2026
Merged

Fix image filtering#533
rteyssandier merged 2 commits into
openflocon:mainfrom
snappdevelopment:fix-image-filter

Conversation

@snappdevelopment

Copy link
Copy Markdown
Contributor

Fixes the filtering for images. This line probably got deleted on accident

@snappdevelopment snappdevelopment added the bug Something isn't working label Jun 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the onFilterChanged function in ImagesViewModel to emit the new filter text. The reviewer suggests optimizing this by directly setting the StateFlow value synchronously (filter.value = text) and removing the unnecessary coroutine wrapper.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


fun onFilterChanged(text: String) {
viewModelScope.launch(dispatcherProvider.viewModel) {
filter.emit(text)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For MutableStateFlow, you can update the value synchronously using filter.value = text instead of calling the suspending emit(text) function. Furthermore, because updating a StateFlow's value is synchronous and thread-safe, you do not need to launch a coroutine via viewModelScope.launch at all. You should remove the coroutine wrapper and update the value directly.

Suggested change
filter.emit(text)
filter.value = text

@rteyssandier rteyssandier merged commit e432b20 into openflocon:main Jun 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants