Merge pull request #19412 from KDSBrowne/v3.multiUserBug

Fix: Multi-User Drawing Issue When Presenter Switches Pages
This commit is contained in:
Anton Georgiev 2024-01-22 11:12:32 -05:00 committed by GitHub
commit a12da64e28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View File

@ -33,7 +33,11 @@ const PresentationContainer = (props) => {
const currentPresentationPage = presentationPageArray && presentationPageArray[0];
const slideSvgUrl = currentPresentationPage && currentPresentationPage.svgUrl;
const { data: whiteboardWritersData } = useSubscription(CURRENT_PAGE_WRITERS_SUBSCRIPTION);
const { data: whiteboardWritersData } = useSubscription(CURRENT_PAGE_WRITERS_SUBSCRIPTION, {
variables: { pageId: currentPresentationPage?.pageId },
skip: !currentPresentationPage?.pageId,
});
const whiteboardWriters = whiteboardWritersData?.pres_page_writers || [];
const [presentationSetZoom] = useMutation(PRESENTATION_SET_ZOOM);

View File

@ -59,7 +59,10 @@ const WhiteboardContainer = (props) => {
const curPageId = currentPresentationPage?.num;
const presentationId = currentPresentationPage?.presentationId;
const { data: whiteboardWritersData } = useSubscription(CURRENT_PAGE_WRITERS_SUBSCRIPTION);
const { data: whiteboardWritersData } = useSubscription(CURRENT_PAGE_WRITERS_SUBSCRIPTION, {
variables: { pageId: currentPresentationPage?.pageId },
skip: !currentPresentationPage?.pageId,
});
const whiteboardWriters = whiteboardWritersData?.pres_page_writers || [];
const hasWBAccess = whiteboardWriters?.some((writer) => writer.userId === Auth.userID);

View File

@ -97,11 +97,13 @@ export const CURRENT_PAGE_ANNOTATIONS_STREAM = gql`subscription annotationsStrea
}
}`;
export const CURRENT_PAGE_WRITERS_SUBSCRIPTION = gql`subscription currentPageWritersSubscription {
pres_page_writers {
export const CURRENT_PAGE_WRITERS_SUBSCRIPTION = gql`
subscription currentPageWritersSubscription($pageId: String!) {
pres_page_writers(where: { pageId: { _eq: $pageId } }) {
userId
}
}`;
}
`;
export const CURRENT_PAGE_WRITERS_QUERY = gql`query currentPageWritersQuery {
pres_page_writers {