mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
@@ -104,18 +104,23 @@ function DataLoader({ match, children }: Props) {
|
||||
|
||||
React.useEffect(() => {
|
||||
async function fetchRevision() {
|
||||
if (revisionId) {
|
||||
try {
|
||||
await revisions[revisionId === "latest" ? "fetchLatest" : "fetch"](
|
||||
revisionId
|
||||
);
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
if (!revisionId) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (revisionId === "latest") {
|
||||
if (document?.id) {
|
||||
await revisions.fetchLatest(document.id);
|
||||
}
|
||||
} else {
|
||||
await revisions.fetch(revisionId);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
}
|
||||
}
|
||||
void fetchRevision();
|
||||
}, [revisions, revisionId]);
|
||||
}, [revisions, revisionId, document?.id]);
|
||||
|
||||
React.useEffect(() => {
|
||||
async function fetchViews() {
|
||||
|
||||
@@ -20,7 +20,8 @@ export default class RevisionsStore extends Store<Revision> {
|
||||
/**
|
||||
* Fetches the latest revision for the given document.
|
||||
*
|
||||
* @returns A promise that resolves to the latest revision for the given document
|
||||
* @param documentId - the id of the document to fetch the latest revision for.
|
||||
* @returns A promise that resolves to the latest revision for the given document.
|
||||
*/
|
||||
fetchLatest = async (documentId: string) => {
|
||||
const res = await client.post(`/revisions.info`, { documentId });
|
||||
|
||||
Reference in New Issue
Block a user