-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
What happened:
When a user sets an initial presence while attaching a document, a presence-changed event is triggered with an undefined presence value. This is because when publishing the presence-changed event, the presence is retrieved using getPresence, which only returns presence for online clients.
What you expected to happen:
The value of the presence-changed event should include the initial presence value set by the user.
How to reproduce it (as minimally and precisely as possible):
Execute following code:
it.only('initial presence', async function ({ task }) {
const c1 = new yorkie.Client(testRPCAddr);
await c1.activate();
const c1ID = c1.getID()!;
const docKey = toDocKey(`${task.name}-${new Date().getTime()}`);
const events1 = new EventCollector<DocEvent>();
type PresenceType = { key: string };
const doc1 = new yorkie.Document<{}, PresenceType>(docKey);
const unsub1 = doc1.subscribe('presence', (event) => events1.add(event));
await c1.attach(doc1, {
initialPresence: { key: 'val1' },
});
await events1.waitAndVerifyNthEvent(1, {
type: DocEventType.PresenceChanged,
value: { clientID: c1ID, presence: { key: 'val1' } }, // presence value is missing
});
unsub1();
});Anything else we need to know?:
Related: yorkie-team/yorkie#671
Environment:
- Operating system:
- Browser and version:
- Yorkie version (use
yorkie version): - Yorkie JS SDK version:
blurfx
Metadata
Metadata
Assignees
Labels
No labels