Skip to content

Don't flicker the screen for very fast operations#399

Merged
sosthene-nitrokey merged 2 commits intoNitrokey:mainfrom
sosthene-nitrokey:small-improvements
Jan 22, 2026
Merged

Don't flicker the screen for very fast operations#399
sosthene-nitrokey merged 2 commits intoNitrokey:mainfrom
sosthene-nitrokey:small-improvements

Conversation

@sosthene-nitrokey
Copy link
Contributor

@sosthene-nitrokey sosthene-nitrokey commented Jan 21, 2026

Previously the busy state was set immediately when an operation is run, this could cause screen flickers for very fast or even instant operations.

This PR makes the busy state visible only if it's still busy after 100ms. 100ms is enough for it to still feel "instant", but gives some lee-way for almost-instant operations to run.

This PR also fixes potential race conditions where if two workers run in parallel the busy state could stop after only the first one:

  • Task A starts -> busy state enabled
  • Task B starts -> busy state not changed
  • Task A ends -> busy state is disabled, even though task B is still running

This would require 2 views operating at the same time so it's unlikely but not impossible.  A busy task counter replaces this.

Got annoyed by the constant flicker in the settings screen while working on #398

I'm not sure it changes anything in practice, but it seemed wasteful
and might lose some state for example for screen readers
Some very fast interactions shouldn't cause a full screen flicker like
it currently does
@sosthene-nitrokey sosthene-nitrokey merged commit 5da9ae7 into Nitrokey:main Jan 22, 2026
30 checks passed
@sosthene-nitrokey
Copy link
Contributor Author

Looks like this leads to the PIN prompts to get disabled because the view disabling now happens after the prompt is opened, so the prompt ends up being disabled too.

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.

3 participants