- It looks like a workspace by this name is not available.
-
-
- Go back to homepage
-
+
+
+
+
+
+ Workspace not found
+
+
+
+ The workspace you're looking for is not available. It may
+ have been deleted or you may not have access to it.
+
+
+
)}
diff --git a/frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx b/frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx
index 0023e33010a..43b8f24fe57 100644
--- a/frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx
+++ b/frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx
@@ -4,6 +4,7 @@ import Workspace from "@/models/workspace";
import paths from "@/utils/paths";
import { useTranslation } from "react-i18next";
import showToast from "@/utils/toast";
+import { clearLastActive } from "@/utils/lastActive";
export default function DeleteWorkspace({ workspace }) {
const { slug } = useParams();
@@ -28,6 +29,8 @@ export default function DeleteWorkspace({ workspace }) {
return;
}
+ clearLastActive();
+
workspace.slug === slug
? (window.location = paths.home())
: window.location.reload();
diff --git a/frontend/src/utils/lastActive.js b/frontend/src/utils/lastActive.js
new file mode 100644
index 00000000000..836f7356ad9
--- /dev/null
+++ b/frontend/src/utils/lastActive.js
@@ -0,0 +1,24 @@
+const LAST_ACTIVE_KEY = "anythingllm_last_active_location";
+
+export const saveLastActive = (workspace, thread = null) => {
+ const location = {
+ workspace,
+ thread,
+ timestamp: Date.now(),
+ };
+ localStorage.setItem(LAST_ACTIVE_KEY, JSON.stringify(location));
+};
+
+export const getLastActive = () => {
+ try {
+ const stored = localStorage.getItem(LAST_ACTIVE_KEY);
+ if (!stored) return null;
+ return JSON.parse(stored);
+ } catch (e) {
+ return null;
+ }
+};
+
+export const clearLastActive = () => {
+ localStorage.removeItem(LAST_ACTIVE_KEY);
+};
diff --git a/frontend/src/utils/paths.js b/frontend/src/utils/paths.js
index 48c28141b39..6449ef09c0d 100644
--- a/frontend/src/utils/paths.js
+++ b/frontend/src/utils/paths.js
@@ -1,4 +1,5 @@
import { API_BASE } from "./constants";
+import { getLastActive } from "./lastActive";
function applyOptions(path, options = {}) {
let updatedPath = path;
@@ -15,6 +16,14 @@ export default {
home: () => {
return "/";
},
+ lastActiveChat: () => {
+ const lastActive = getLastActive();
+ if (!lastActive?.workspace) return "/";
+ if (lastActive.thread) {
+ return `/workspace/${lastActive.workspace}/t/${lastActive.thread}`;
+ }
+ return `/workspace/${lastActive.workspace}`;
+ },
login: (noTry = false) => {
return `/login${noTry ? "?nt=1" : ""}`;
},