mirror of
https://github.com/docmost/docmost.git
synced 2025-11-13 17:02:36 +10:00
updates and fixes
* seo friendly urls * custom client serve-static module * database fixes * fix recent pages * other fixes
This commit is contained in:
@ -12,6 +12,9 @@ export const useQuerySubscription = () => {
|
||||
socket?.on("message", (event) => {
|
||||
const data: WebSocketEvent = event;
|
||||
|
||||
let entity = null;
|
||||
let queryKeyId = null;
|
||||
|
||||
switch (data.operation) {
|
||||
case "invalidate":
|
||||
queryClient.invalidateQueries({
|
||||
@ -19,8 +22,16 @@ export const useQuerySubscription = () => {
|
||||
});
|
||||
break;
|
||||
case "updateOne":
|
||||
queryClient.setQueryData([...data.entity, data.id], {
|
||||
...queryClient.getQueryData([...data.entity, data.id]),
|
||||
entity = data.entity[0];
|
||||
if (entity === "pages") {
|
||||
// we have to do this because the usePageQuery cache key is the slugId.
|
||||
queryKeyId = data.payload.slugId;
|
||||
} else {
|
||||
queryKeyId = data.id;
|
||||
}
|
||||
|
||||
queryClient.setQueryData([...data.entity, queryKeyId], {
|
||||
...queryClient.getQueryData([...data.entity, queryKeyId]),
|
||||
...data.payload,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user