Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pages/manage/storages/AddOrEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Drivers = Record<string, DriverInfo>

const AddOrEdit = () => {
const t = useT()
const { params, back, to } = useRouter()
const { params, to } = useRouter()
const { id } = params
const [driversLoading, loadDrivers] = useFetch(
(): PResp<Drivers> => r.get("/admin/driver/list"),
Expand Down Expand Up @@ -209,7 +209,7 @@ const AddOrEdit = () => {
resp,
() => {
notify.success(t("global.save_success"))
back()
to("/@manage/storages")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Replace the edit entry instead of pushing the list

When a user follows the normal list → edit → save flow, to() calls navigate(path, options) without replace, so this leaves the editor in history and creates list → edit → list; pressing Back after saving now reopens the just-saved editor, whereas the previous back() returned to the original list entry. Pass { replace: true } through the third argument to to() so navigation is deterministic without retaining the stale edit page.

Useful? React with 👍 / 👎.

},
(msg, code) => {
if (resp.data.id) {
Expand Down