fix: After renaming collection, url does not update
This commit is contained in:
@@ -4,6 +4,7 @@ import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import { useState } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import Button from "components/Button";
|
||||
import Flex from "components/Flex";
|
||||
import HelpText from "components/HelpText";
|
||||
@@ -30,6 +31,7 @@ const CollectionEdit = ({ collectionId, onSubmit }: Props) => {
|
||||
field: string,
|
||||
direction: "asc" | "desc",
|
||||
}>(collection.sort);
|
||||
const history = useHistory();
|
||||
const [isSaving, setIsSaving] = useState();
|
||||
const { showToast } = useToasts();
|
||||
const { t } = useTranslation();
|
||||
@@ -46,6 +48,8 @@ const CollectionEdit = ({ collectionId, onSubmit }: Props) => {
|
||||
color,
|
||||
sort,
|
||||
});
|
||||
|
||||
history.push(collection.url);
|
||||
onSubmit();
|
||||
showToast(t("The collection was updated"), {
|
||||
type: "success",
|
||||
@@ -56,7 +60,7 @@ const CollectionEdit = ({ collectionId, onSubmit }: Props) => {
|
||||
setIsSaving(false);
|
||||
}
|
||||
},
|
||||
[collection, color, icon, name, onSubmit, showToast, sort, t]
|
||||
[collection, history, color, icon, name, onSubmit, showToast, sort, t]
|
||||
);
|
||||
|
||||
const handleSortChange = (value: string) => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { HocuspocusProvider, WebSocketStatus } from "@hocuspocus/provider";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useHistory } from "react-router";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { IndexeddbPersistence } from "y-indexeddb";
|
||||
import * as Y from "yjs";
|
||||
import Editor, { type Props as EditorProps } from "components/Editor";
|
||||
|
||||
Reference in New Issue
Block a user