i want to add some other fields that comes with the default account publish null in a package, but addAutopublishFields only works with autopublish enabled.
https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_server.js#L31
https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_server.js#L740
write this in package will cause tacker rerun two times
Meteor.publish(null, function () {
if (!this.userId)
return
return Meteor.users.find({ _id: this.userId }, { fields: { [CROSS_ACCOUNTS_FIELD]: true } })
})


can we just allow this without adding autopublish package ?
Accounts.addAutopublishFields({
forLoggedInUser: [otherFields],
})
@crapthings correct me if I'm wrong, but I think this feature has been implemented:
Accounts.addAutopublishFields({
forLoggedInUser: ['createdAt', 'secret'],
forOtherUsers: ['createdAt'],
})
Accounts.onCreateUser(({ password, ...option }, user) => ({ ...option, ...user }))
Accounts.addAutopublishFields({
forLoggedInUser: ['hello'],
forOtherUsers: ['hello'],
})
Meteor.publish('currentUser', function () {
return Meteor.users.find({ _id: this.userId }, { fields: { services: false } })
})
Meteor.startup(function () {
if (Meteor.users.findOne()) return
Accounts.createUser({ username: 'demo', password: 'demo', hello: 'kitty' })
})

@StorytellerCZ still doesn't work.
the solution for now
i start a 'currentUser' subscribe and wait for its ready after user login.
there will be two ddp messages send, one from accounts its self(publish null), and the subscribe one.
1. Meteor.userId() && !Meteor.loggingIn()
2. Meteor.subscribe('currentUser').ready()
3. render UI
if addAutopublishFields works, i can remove the extra subscribe
Check the defaultFieldSelector option of Accounts.config
it looks the defaultFieldSelector doesn't override by config
Accounts.config({
defaultFieldSelector: { hello: 1 }
})
Accounts.config({
defaultFieldSelector: { fields: { hello: 1 } }
})
Accounts.config({
defaultFieldSelector: { projection: { hello: 1 } }
})

Most helpful comment
can we just allow this without adding autopublish package ?