Skip to content

subscription of computed observable triggered even when value is same #1884

@fastfasterfastest

Description

@fastfasterfastest

I have a pureComputed that returns a javascript Date object. I register a subscription to the pureComputed's changes using .subscribe. However, the subscription is triggered even when the same value is returned by the pureComputed.

The reason is explained at http://knockoutjs.com/documentation/computedObservables.html which states:

When a computed observable returns a primitive value (a number, string, boolean, or null), the dependencies of the observable are normally only notified if the value actually changed.

My pureComputed does not hold a "primitive value", but instead a javascript Date object. Would it be reasonable to request knockout to handle a javascript Date object the same way as it currently handles "primitive values" (perhaps by using .valueOf())?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions