meteor / meteor/meteor

Issue with `observeAsync` in Meteor 3.0.4

Open
#13,453 3 comments 0 reactions 0 assignees View on GitHub
idle Project:Accounts (in user apps) Project:Mongo Driver
Dominant language
JavaScript
Stars
44.8k
Forks
5.2k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

**Title:** Issue with `observeAsync` in Meteor 3.0.4 causing user object to revert to database state

### Description:
There is a bug in Meteor 3.0.4 related to the `publish` of the currently logged-in user's information. I am using `observeAsync` to modify and add data to the user object before it is sent to the client. The issue arises when the modified user object, which prints correctly on the server before being sent, appears incorrect on the frontend.

### Meteor Version:
Meteor 3.0.4

### Last Working Version:
Not applicable (or specify if known)

### Operating System:
MacOS 15.2

### Expected Behavior:
The user object modified on the server using `observeAsync` should be sent to the client as-is, with no automatic overrides by the fields present in the database.

### Actual Behavior:
The user object appears correct when printed on the server before being sent to the client. However, on the frontend, the modified fields (e.g., the `profile` field) are being overridden by the data from the database, which leads to discrepancies.

### Steps to Reproduce:
1. Set up a publication with `observeAsync` to modify the user object.
2. Print the modified user object on the server before sending it to the client.
3. Check the client-side output of the user object.

**Expected Result**: The client receives the modified user object with the changes applied server-side.
**Actual Result**: The client receives a user object where the modified fields are reverted to match the database state.

### Reproduction:
A minimal reproduction can be provided if needed. Please let me know if it’s necessary.

![Screenshot 2024-11-11 alle 10 45 10](https://github.com/user-attachments/assets/9866eaa8-72ed-424f-83d4-e35fb80708b2)

Contributor guide

Open the contributing guide

Research direction

Start with a minimal publication using observeAsync on Meteor 3.0.4 and compare the server-side user object with the client-side result. Confirm whether modified fields such as profile are overwritten by database values; done means the client consistently receives the server-side changes, with a reproducible test or example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.