scorpiusjs / scorpius

Modular admin solution built with Meteor
http://scorpiusjs.org
MIT License
34 stars 7 forks source link

Editing task in admin - subscription to adminGetOne publication doesn't update fields #58

Open JulianKingman opened 7 years ago

JulianKingman commented 7 years ago

When clicking to edit a task in the admin interface, the new fields that are subscribed to don't show up (their value appears undefined). I think this is a problem with subscriptions in general, do you know the best solution?

JulianKingman commented 7 years ago

A temporary fix can be achieved by removing "fields" from my custom admin publication, which looks like this:

publishComposite('results/admin', (tableName, ids, fields) => {
  check(tableName, String);
  check(ids, Array);
  check(fields, Match.Optional(Object));
  // this.unblock();
  return [
    {
      find() {
        console.log(Result.find({ _id: { $in: ids } }, { fields }).fetch(), fields);
        return Result.find({ _id: { $in: ids } }); //, { fields });
      },
    },
    {
      find() {
        return Contestant.find();
      },
    },
    {
      find() {
        return Event.find();
      },
    },
    {
      find() {
        return Episode.find();
      },
    },
  ];
});
rwatts3 commented 7 years ago

Are you still having this issue ?

JulianKingman commented 7 years ago

Yes. Are you able to reproduce? The publication above is a custom publication for tabular. Tabular doesn't show all the fields that exist for the document. When clicking through to edit a document, only the fields subscribed to by the custom tabular publication appear, the others appear as undefined, at least until the page is refreshed.

rwatts3 commented 7 years ago

You shouldn't have to remove the fields this may be an underlying bug in subscriptions. I'll keep this open for now until we can resolve what the actual problem is related to.