fix: Models are not all removed from local store upon access change (#3729)

* fix: Clean data from stores correctly on 401/403 response

* Convert DataLoader from class component, remove observables and caching

* types
This commit is contained in:
Tom Moor
2022-07-03 22:48:50 +02:00
committed by GitHub
parent 9cd26168e1
commit 5d498632c6
7 changed files with 165 additions and 212 deletions

View File

@@ -7,13 +7,21 @@ import DataLoader from "./components/DataLoader";
import Document from "./components/Document";
import SocketPresence from "./components/SocketPresence";
export default function DocumentScene(
props: RouteComponentProps<
{ documentSlug: string; revisionId: string },
StaticContext,
{ title?: string }
>
) {
type Params = {
documentSlug: string;
revisionId?: string;
shareId?: string;
};
type LocationState = {
title?: string;
restore?: boolean;
revisionId?: string;
};
type Props = RouteComponentProps<Params, StaticContext, LocationState>;
export default function DocumentScene(props: Props) {
const { ui } = useStores();
const team = useCurrentTeam();
const { documentSlug, revisionId } = props.match.params;
@@ -47,12 +55,12 @@ export default function DocumentScene(
if (isActive && !isMultiplayer) {
return (
<SocketPresence documentId={document.id} isEditing={isEditing}>
<Document document={document} match={props.match} {...rest} />
<Document document={document} {...rest} />
</SocketPresence>
);
}
return <Document document={document} match={props.match} {...rest} />;
return <Document document={document} {...rest} />;
}}
</DataLoader>
);