mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix(focus-mode): prevent taskbar progress bar filling every second
Converts setTaskBarProgress$ effect from selector-based to action-based with 500ms throttling to prevent excessive IPC calls. The selector-based effect was firing on every timer tick (1s), causing the Windows taskbar progress bar to fill completely every second instead of gradually over the session duration. Fixes #6061
This commit is contained in:
parent
955a3e13c5
commit
b77f18f681
1 changed files with 23 additions and 4 deletions
|
|
@ -633,14 +633,33 @@ export class FocusModeEffects {
|
|||
);
|
||||
|
||||
// Electron-specific effects
|
||||
// Action-based effect to update Windows taskbar progress (fixes #6061)
|
||||
// Throttled to prevent excessive IPC calls (timer ticks every 1s)
|
||||
// Follows action-based pattern (CLAUDE.md Section 8) instead of selector-based
|
||||
setTaskBarProgress$ =
|
||||
IS_ELECTRON &&
|
||||
createEffect(
|
||||
() =>
|
||||
this.store.select(selectors.selectProgress).pipe(
|
||||
skipWhileApplyingRemoteOps(),
|
||||
withLatestFrom(this.store.select(selectors.selectIsRunning)),
|
||||
tap(([progress, isRunning]) => {
|
||||
this.actions$.pipe(
|
||||
ofType(
|
||||
actions.tick,
|
||||
actions.startFocusSession,
|
||||
actions.pauseFocusSession,
|
||||
actions.unPauseFocusSession,
|
||||
actions.startBreak,
|
||||
actions.skipBreak,
|
||||
actions.completeBreak,
|
||||
actions.completeFocusSession,
|
||||
actions.cancelFocusSession,
|
||||
),
|
||||
// Throttle to prevent excessive IPC calls (timer ticks every 1s)
|
||||
// Use leading + trailing to ensure immediate feedback and final state
|
||||
throttleTime(500, undefined, { leading: true, trailing: true }),
|
||||
withLatestFrom(
|
||||
this.store.select(selectors.selectProgress),
|
||||
this.store.select(selectors.selectIsRunning),
|
||||
),
|
||||
tap(([_action, progress, isRunning]) => {
|
||||
window.ea.setProgressBar({
|
||||
progress: progress / 100,
|
||||
progressBarMode: isRunning ? 'normal' : 'pause',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue