mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 00:46:45 +00:00
fix(tasks): guard ShortSyntaxEffects against undefined task during concurrent sync
When a WebSocket-triggered archive sync applies a moveToArchive operation concurrently with a local rename, the ShortSyntaxEffects' getByIdOnce$() call returns undefined because the task has already been moved out of the active NgRx store. Calling shortSyntax(undefined, ...) then throws a TypeError that triggers a global error dialog, blocking UI interactions such as navigating to the worklog. Fix: add an early-return EMPTY guard after getByIdOnce$() resolves so the effect silently no-ops when the task no longer exists in the store.
This commit is contained in:
parent
791fa533e7
commit
309670db3a
1 changed files with 7 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ import {
|
|||
import { GlobalConfigService } from '../../config/global-config.service';
|
||||
import { unique } from '../../../util/unique';
|
||||
import { TaskService } from '../task.service';
|
||||
import { from, of } from 'rxjs';
|
||||
import { EMPTY, from, of } from 'rxjs';
|
||||
import { ProjectService } from '../../project/project.service';
|
||||
import { TagService } from '../../tag/tag.service';
|
||||
import { shortSyntax } from '../short-syntax';
|
||||
|
|
@ -102,6 +102,12 @@ export class ShortSyntaxEffects {
|
|||
),
|
||||
),
|
||||
mergeMap(([{ task, originalAction }, tags, projects, defaultProjectId]) => {
|
||||
// Guard: task may have been archived/deleted while the effect was in flight
|
||||
// (e.g., a concurrent sync applied a moveToArchive op). Skip processing
|
||||
// to prevent "Cannot read properties of undefined" errors.
|
||||
if (!task) {
|
||||
return EMPTY;
|
||||
}
|
||||
const isReplaceTagIds = originalAction.type === TaskSharedActions.updateTask.type;
|
||||
return from(
|
||||
shortSyntax(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue