Skip to content

Issue with using observeChanges in autorun function #50

@kerf007

Description

@kerf007

Hello, Before using meteor-reactive-publish, my publish function code looked like:

let handle = cursor.observe({
        added: doc => {
          this.added('placeholders', doc._id, transform(doc))
        },
        changed: (newDoc, oldDoc) => {
          this.changed('placeholders', oldDoc._id, transform(newDoc))
        },
        removed: doc => {
          this.removed('placeholders', doc._id)
        }
})

So some transformation function was used.
Then I added meteor-reactive-publish and wrapped this code in this.autorun. And now when I get DDP messages - first I get added message with some extra field from transform function, but then I get changed message that has cleared field with my extra field names and this fields are removing.
Снимок экрана 2019-10-03 в 12 08 18

I can't understand why this happens and how to transform data before publish to client?
Help please :)

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