feat: remember last selected team id (#2210)
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com> Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
@@ -53,6 +53,7 @@ import { WSRequest$, setWSRequest } from "./WebSocketSession"
|
||||
import { SIORequest$, setSIORequest } from "./SocketIOSession"
|
||||
import { SSERequest$, setSSERequest } from "./SSESession"
|
||||
import { MQTTRequest$, setMQTTRequest } from "./MQTTSession"
|
||||
import { bulkApplyLocalState, localStateStore } from "./localstate"
|
||||
|
||||
function checkAndMigrateOldSettings() {
|
||||
const vuexData = JSON.parse(window.localStorage.getItem("vuex") || "{}")
|
||||
@@ -114,6 +115,18 @@ function checkAndMigrateOldSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
function setupLocalStatePersistence() {
|
||||
const localStateData = JSON.parse(
|
||||
window.localStorage.getItem("localState") ?? "{}"
|
||||
)
|
||||
|
||||
if (localStateData) bulkApplyLocalState(localStateData)
|
||||
|
||||
localStateStore.subject$.subscribe((state) => {
|
||||
window.localStorage.setItem("localState", JSON.stringify(state))
|
||||
})
|
||||
}
|
||||
|
||||
function setupSettingsPersistence() {
|
||||
const settingsData = JSON.parse(
|
||||
window.localStorage.getItem("settings") || "{}"
|
||||
@@ -313,6 +326,7 @@ function setupRequestPersistence() {
|
||||
export function setupLocalPersistence() {
|
||||
checkAndMigrateOldSettings()
|
||||
|
||||
setupLocalStatePersistence()
|
||||
setupSettingsPersistence()
|
||||
setupRequestPersistence()
|
||||
setupHistoryPersistence()
|
||||
|
||||
Reference in New Issue
Block a user