mirror of
https://github.com/suitenumerique/docs.git
synced 2026-04-25 17:15:01 +02:00
🏷️(frontend) adapt thread new type
We stopped to use pagination for thread comments, so we need to adapt the thread type to reflect that.
This commit is contained in:
@@ -142,6 +142,7 @@ test.describe('Doc Version', () => {
|
|||||||
const thread = page.locator('.bn-thread');
|
const thread = page.locator('.bn-thread');
|
||||||
await thread.getByRole('paragraph').first().fill('This is a comment');
|
await thread.getByRole('paragraph').first().fill('This is a comment');
|
||||||
await thread.locator('[data-test="save"]').click();
|
await thread.locator('[data-test="save"]').click();
|
||||||
|
await expect(thread).toBeHidden();
|
||||||
|
|
||||||
await goToGridDoc(page, {
|
await goToGridDoc(page, {
|
||||||
title: randomDoc,
|
title: randomDoc,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { CommentBody, ThreadStore } from '@blocknote/core/comments';
|
import { CommentBody, ThreadStore } from '@blocknote/core/comments';
|
||||||
import type { Awareness } from 'y-protocols/awareness';
|
import type { Awareness } from 'y-protocols/awareness';
|
||||||
|
|
||||||
import { APIError, APIList, errorCauses, fetchAPI } from '@/api';
|
import { APIError, errorCauses, fetchAPI } from '@/api';
|
||||||
import { Doc } from '@/features/docs/doc-management';
|
import { Doc } from '@/features/docs/doc-management';
|
||||||
|
|
||||||
import { useEditorStore } from '../../stores';
|
import { useEditorStore } from '../../stores';
|
||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
ServerThread,
|
ServerThread,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
type ServerThreadListResponse = APIList<ServerThread>;
|
type ServerThreadListResponse = ServerThread[];
|
||||||
|
|
||||||
export class DocsThreadStore extends ThreadStore {
|
export class DocsThreadStore extends ThreadStore {
|
||||||
protected static COMMENTS_PING = 'commentsPing';
|
protected static COMMENTS_PING = 'commentsPing';
|
||||||
@@ -335,7 +335,7 @@ export class DocsThreadStore extends ThreadStore {
|
|||||||
|
|
||||||
const threads = (await response.json()) as ServerThreadListResponse;
|
const threads = (await response.json()) as ServerThreadListResponse;
|
||||||
const next = new Map<string, ClientThreadData>();
|
const next = new Map<string, ClientThreadData>();
|
||||||
threads.results.forEach((thread) => {
|
threads.forEach((thread) => {
|
||||||
const threadData: ClientThreadData = serverThreadToClientThread(thread);
|
const threadData: ClientThreadData = serverThreadToClientThread(thread);
|
||||||
next.set(thread.id, threadData);
|
next.set(thread.id, threadData);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user