diff --git a/app/components/WebsocketProvider.tsx b/app/components/WebsocketProvider.tsx index f3bdc1a63..90f64c5e9 100644 --- a/app/components/WebsocketProvider.tsx +++ b/app/components/WebsocketProvider.tsx @@ -287,6 +287,15 @@ class WebsocketProvider extends React.Component { }); this.socket.on("collections.update", (event: PartialWithId) => { + if ( + "sharing" in event && + event.sharing !== collections.get(event.id)?.sharing + ) { + documents.all.forEach((document) => { + policies.remove(document.id); + }); + } + collections.add(event); }); @@ -313,6 +322,12 @@ class WebsocketProvider extends React.Component { ); this.socket.on("teams.update", (event: PartialWithId) => { + if ("sharing" in event && event.sharing !== auth.team?.sharing) { + documents.all.forEach((document) => { + policies.remove(document.id); + }); + } + auth.team?.updateFromJson(event); });