You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have reviewed the FAQ and known issues and did not find my topic
I have updated my code to use the new localUser object on the LivePresence class. Using the test live share server running on localHost, the presence object that is the first argument of the presenceChanged event does not have the localUser object. It has the previous userId, data, and state properties.
Provide a clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Go to '...'
Click on '....'
Scroll down to '....'
See error
Expected behavior
Provide a clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop(s) (please complete the following information):
OS: [e.g. macOS]
Browser [e.g. chrome, safari]
Version liveShare 1.0.1
Smartphone (please complete the following information):
Device: Wndows
OS: Windows 11
Browser Edge
Version [e.g. 22]
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
The LivePresenceUseruserPresence variable in your screenshot still has userId, data, and state properties, which are the grayed out properties in your screenshot.
LivePresence.localUser is a property on the top level LivePresence object, not the LivePresenceUser object returned in onPresenceChanged.
The localUser property returns a LivePresenceUser object which is the same type as the one returned in onPresenceChanged.
Does that help?
LivePresence also starts to listen for other presence updates before the local user is finished initializing.
If you use the top level LivePresence.localUser, there is a chance you could receive onPresenceChanged updates for other clients before the localUser is defined.
This is after the initialization. The problem is that the Typescript definition of the LivePresence object no longer has the userId, data, and state properties - I have to cast to have my TypeScript code compile.
@mscherotter I'd recommend making your app robust around whether or not the localUser is defined or not. That can take a second before it is ready, since it is an asynchronous operation to fetch the user info. There should be no reason to cast as long as your app can handle localUser being undefined temporarily.
I have updated my code to use the new localUser object on the LivePresence class. Using the test live share server running on localHost, the presence object that is the first argument of the presenceChanged event does not have the localUser object. It has the previous userId, data, and state properties.
To Reproduce
Expected behavior
Screenshots
Desktop(s) (please complete the following information):
Smartphone (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: