mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
bf45e97641
* Update types * fix circular dep * type imports * lint type imports and --fix
22 lines
478 B
TypeScript
22 lines
478 B
TypeScript
import { observer } from "mobx-react";
|
|
import * as React from "react";
|
|
import type Collection from "~/models/Collection";
|
|
|
|
type Props = {
|
|
enabled: boolean;
|
|
collection: Collection;
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
function DocumentsLoader({ collection, enabled, children }: Props) {
|
|
React.useEffect(() => {
|
|
if (enabled) {
|
|
void collection.fetchDocuments();
|
|
}
|
|
}, [collection, enabled]);
|
|
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export default observer(DocumentsLoader);
|