Skip to content

Remove use of magic numbers as state flags in watch.ts #1003

@samayer12

Description

@samayer12

Describe what should be investigated or refactored

In watch.ts, we have a few magic numbers which should be avoided. The use of magic numbers as sentinel values can be confusing and error-prone.

Specific points in file:

watch.ts:78 - #lastSeenTime = NONE mixes timestamp data with state flags
watch.ts:518-519 - Comparison this.#lastSeenTime === NONE is semantically unclear
watch.ts:525 - this.#lastSeenTime === OVERRIDE mixed with timestamp comparisons

As an alternative, let's create a state enum or use a nullable timestamp instead of these magic numbers.

Links to any relevant code

See the following block:

const NONE = 50;
const OVERRIDE = 100;

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions