microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

[BUG] Presence no longer working when template Person from People/Login components

Open NathZ1 opened this issue 3 years ago • 12 comments

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;

image

Expected behavior Presence works like it is meant to (and previously did)

Screenshots my app dev env: image

same page, prod env: image

Environment (please complete the following information):

  • OS: Windows 10
  • Browser: Chromium
  • Framework: React
  • Context
  • Version: 2.3.2
  • Provider: Msal2Provider]

NathZ1 avatar Mar 03 '22 07:03 NathZ1

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 🙌

ghost avatar Mar 03 '22 07:03 ghost

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!

sebastienlevert avatar Mar 14 '22 15:03 sebastienlevert

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?

NathZ1 avatar Mar 14 '22 20:03 NathZ1

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?

sebastienlevert avatar Mar 14 '22 21:03 sebastienlevert

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: @.***>

NathZ1 avatar Mar 14 '22 22:03 NathZ1

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!

sebastienlevert avatar Mar 18 '22 15:03 sebastienlevert

This workaround does the job. Thanks for that :)

NathZ1 avatar Mar 19 '22 09:03 NathZ1

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.

image

image

NathZ1 avatar Mar 21 '22 04:03 NathZ1

So, when the personImage is coming from elsewhere, you are saying the presence is not loaded?

sebastienlevert avatar Mar 21 '22 13:03 sebastienlevert

Presence is not working regardless.

The proposed workaround of using userId doesn't work when photos are loaded from elsewhere unfortunately.

NathZ1 avatar Mar 21 '22 21:03 NathZ1

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!

NathZ1 avatar Jun 15 '22 03:06 NathZ1

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!

sebastienlevert avatar Jun 21 '22 15:06 sebastienlevert

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: @.***>

NathZ1 avatar Oct 11 '22 07:10 NathZ1