-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a refresh for presence #2916
Implement a refresh for presence #2916
Conversation
Thanks for the PR @plasne. I'm wondering if we shouldn't do the work upstream, in the |
The issue with doing it in the mgt-person component is that you could get out-of-sync (a person showing "away" from one component and "available" in another). Thoughts? |
We had a good conversation about this feature and here is what we think could deliver the value directly at the component level with the help of some global service that would act as an "orchestrator".
Open questions:
|
OK, that all makes sense and I can rework it:
When I return after Christmas, I can put some of this together and maybe we can chat about some of those implementation details. |
@sebastienlevert I have changed the implementation to use a PresenceService. Can you review again and let me know what else you might want different? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great work, thank you so much for this.
There's a few things that need to be changed but the core here is solid.
One thing that I didn't add a comment for is that yarn build
needs to be run to update the generated React wrapper component and it's available props.
packages/mgt-components/src/components/mgt-person/mgt-person.ts
Outdated
Show resolved
Hide resolved
packages/mgt-components/src/components/mgt-person/mgt-person.tests.ts
Outdated
Show resolved
Hide resolved
@sebastienlevert and @gavinbarron, please review again. I have made all the requested changes. Thanks for the informative and timely review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionnaly, this is amazing! Works great, very snappy, visually appealing and only the presence icon changes so this is a BIG win!
Based on the limits of this API, I'm wondering if we should be test a little bit more.
- Maximum of 650 user IDs are supported per API request.
- The maximum request rate of this API is 1500 API requests in a 30 second period, per application per tenant.
That means we couldn't make more than 1500 API requests every 30 seconds. So first, I'd align our polling to be 30 seconds to ensure we don't fall into these limits. This also means that a "maximum" of 1500 people can use the presence service at the same time in the same tenant. I think it's fair but let's think about this. And ensure we have a good story about backing off if this goes off track.
I will add batching for no more than 650 users in a call (see graph.userWithPhoto). |
Do you want to make this an active PR @plasne? I think we highly aligned here so the need for a draft is not required anymore! Thanks! |
I removed DRAFT. I will hopefully get these changes in later today, but if not, early next week. |
@sebastienlevert , @gavinbarron , ready for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/mgt-chat/src/components/ChatHeader/OneToOneChatHeader.tsx
Outdated
Show resolved
Hide resolved
I think the confusion is the story is NOT a mock. This is just some JavaScript to fake the behavior. I didn't see any samples in storybook that were mocks and after talking it over with other team members that used storybook, they suggesting not mocking. If we want this to be a mock, then I have to figure out how we even do that. |
Co-authored-by: Sébastien Levert <sebastienlevert@users.noreply.github.com>
Let's call it fake! It works great with the Sandbox tenant and I love that it's there. Some other stories have been using something similar in the past, so it's absolutely fine! What I'm suggesting is that we add another component on this story that is just the normal component. That way, when signed in, it will actually poll for presence changes! |
Co-authored-by: Sébastien Levert <sebastienlevert@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, I made a small correction to the disabled refresh component in the story, but otherwise this looks good to me
040beb6
into
microsoftgraph:next/mgt-chat
feat: add a refresh for presence (microsoftgraph#2916)
Closes #264
PR Type
Description of the changes
This PR creates a PresenceService that allows PresenceAwareComponents (currently only MgtPerson) to register a userID for presence changes and then receive notification on those changes. This design ensures that all registered components get updates at the same time. The original method of setting presence is replaced by this method provided "show-presence" and "refresh-presence" are both true.
There is configuration that allows for setting the initial and refresh times in milliseconds.
The PR includes unit tests covering the new functionality.
PR checklist
yarn build
) and changes have been tested in at least two supported browsers (Edge + non-Chromium based browser)yarn setLicense
)Other information
This should not be a breaking change. If
iteration
is not changed, there is no change to presence.