[BUG] Presence no longer working when template Person from People/Login components
Describe the bug This is a new error that must have been introduced recently as presence works as expected in my production environment but not on my dev environment. I think this has been introduced in 2.3.2 as my prod environment is running 2.3.1 and dev is 2.3.2.
Essentially, when i template out Person from People component or Person (signed-in-button-context template) from Login component, the presence of the user doesn't load as expected. Scopes are all fine and presence works when not templating.
I can reproduce this in the react sample app:
To Reproduce
App.tsx:
import React from 'react';
import { Login, Person, People, MgtTemplateProps, PersonCardInteraction, ViewType } from '@microsoft/mgt-react';
const PersonTemplate = ({ dataContext }: MgtTemplateProps) => {
//Login component passes in personDetails, whereas People component passes in person
const { person, personDetails } = dataContext;
return <Person personDetails={personDetails || person} showPresence={true} />;
};
export const App = () => {
const testUser = 'xxxxxxxxxxxxxxx';
return (
<div className="App">
{/*presence not shown by usually*/}
<Login />
{/*presence showing as offline*/}
<Login>
<PersonTemplate template="signed-in-button-content" />
</Login>
{/*presence working fine*/}
<People userIds={[testUser]} personCardInteraction={PersonCardInteraction.none} showPresence={true} />
{/*presence showing as offline*/}
<People userIds={[testUser]}>
<PersonTemplate template="person" />
</People>
{/*presence working fine*/}
<Person userId={testUser} showPresence={true} />
</div>
);
};
export default App;

Expected behavior Presence works like it is meant to (and previously did)
Screenshots
my app dev env:

same page, prod env:

Environment (please complete the following information):
- OS: Windows 10
- Browser: Chromium
- Framework: React
- Context
- Version: 2.3.2
- Provider: Msal2Provider]
Hello NathZ1, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
This is a good catch @NathZ1. I'm thinking about something else. You are doing that work because we don't support presence in the default mgt-login... But do you feel we should support show-presence to the default mgt-login component?
I would agree this could deliver an interesting value. Let me know your thoughts!
Hi @sebastienlevert, adding presence to Login could be useful, but I'd still need to get it working again in templates as well (mainly templating out Person from MGT People). Any idea what has changed with the recemt update(s) that might have affected this functionality?
Do you get any errors from the endpoints? As we can see the presence "indicator" I'm wondering if this could be linked to some calls now failing?
No errors. When viewing the network traffic it looks like the presence endpoints are not being hit at allOn 15 Mar. 2022 7:13 am, Sébastien Levert @.***> wrote: Do you get any errors from the endpoints? As we can see the presence "indicator" I'm wondering if this could be linked to some calls now failing?
—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>
I was able to reproduce the error. For now, the way I was able to go around it is to provide the userId instead of the personDetails to the component. As the user is already in the cache, this should avoid doing back and forths with Graph.
const PersonTemplate = ({ dataContext }: MgtTemplateProps) => {
const { person, personDetails } = dataContext;
return <Person userId={personDetails.id || person.id} showPresence={true} />;
};
We will be looking into this and log it as a bug, but let us know if the work around can work, for now. Thanks!
This workaround does the job. Thanks for that :)
Actually, this doesn't work when providing personImage prop. I didn't pick this up when initially testing as my dev environment doesn't have any personImages loaded so it is always undefined.


So, when the personImage is coming from elsewhere, you are saying the presence is not loaded?
Presence is not working regardless.
The proposed workaround of using userId doesn't work when photos are loaded from elsewhere unfortunately.
any update on this bug-fix @sebastienlevert, @Mnickii? I was just reminded by my app users that they can't see user presence for anyone!
No update yet on this specific feature. We have prioritized it for the next semester (before end of CY22) but don't have specific dates. If you want to take a stab at it, you are more than welcome! If not, we will do our best to get there!
Presence is not working regardless. The proposed workaround of using userId doesn't work when photos are loaded from elsewhere unfortunately.On 21 Mar. 2022 11:31 pm, Sébastien Levert @.***> wrote: So, when the personImage is coming from elsewhere, you are saying the presence is not loaded?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>