Skip to content

"lazy: true" fails to stop updates #122

Open
@cepm-nate

Description

@cepm-nate

I think this line is to blame:

if (isLazyActive(this, key)) {

Logic goes like this:

  • "isComputedLazy": "Does the asyncComputed property have the 'lazy' property?
  • "isLazyActive": "Is the [lazy] property set to true?
  • If both above are true, then it does return nonLazy.call(this).

Note the last step. That seems backwards. Shouldn't it be return silentGetLazy(this, key), if this is a [lazy] property, and set to active?

In my .vue file I have a simple asyncComputed property with lazy: true, and a console.log within it's getter. The console.log fires whenever a referenced property updates, even though lazy is set to true.

    CallRecordingInfo: {
      default() { return false; },
      lazy: false,
      get() {
        if (!this.Call || !this.Call.Call) return Promise.resolve(false);
        console.log('Updating CalLRecordingInfo', this);
        return api.calls().getRecordingUrl(
          this.UUID,
          this.HQCo,
          this.Call.Call,
        ).catch(() => Promise.resolve(false));
      },
    },

When looking at the console.log output for this, it shows async_computed$lazy_active$CallRecordingInfo: true and async_computed$lazy_data$CallRecordingInfo: Object.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions