fix: show all templates in the menu (#7950)

* fetch all templates

* websocket events for workspace templates
This commit is contained in:
Hemachandar
2024-11-15 06:01:48 +05:30
committed by GitHub
parent bb43c24efe
commit 54f82cac96
3 changed files with 7 additions and 1 deletions
@@ -11,7 +11,7 @@ const useTemplatesAction = () => {
const { documents } = useStores();
React.useEffect(() => {
void documents.fetchTemplates();
void documents.fetchAllTemplates();
}, [documents]);
const actions = React.useMemo(
+4
View File
@@ -368,6 +368,10 @@ export default class DocumentsStore extends Store<Document> {
fetchTemplates = async (options?: PaginationParams): Promise<Document[]> =>
this.fetchNamedPage("list", { ...options, template: true });
@action
fetchAllTemplates = async (options?: PaginationParams): Promise<Document[]> =>
this.fetchAll({ ...options, template: true });
@action
fetchAlphabetical = async (options?: PaginationParams): Promise<Document[]> =>
this.fetchNamedPage("list", {
@@ -852,6 +852,8 @@ export default class WebsocketsProcessor {
channels.push(
...this.getCollectionEventChannels(event, document.collection)
);
} else if (document.isWorkspaceTemplate) {
channels.push(`team-${document.teamId}`);
} else {
channels.push(`collection-${document.collectionId}`);
}