Skip to content

Commit

Permalink
Clear player head cache/queue on server change
Browse files Browse the repository at this point in the history
  • Loading branch information
JLyne committed Jan 17, 2022
1 parent b82c9f3 commit 4535af7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Sidebar from './components/Sidebar.vue';
import ChatBox from './components/ChatBox.vue';
import {useStore} from "@/store";
import {ActionTypes} from "@/store/action-types";
import {parseUrl} from '@/util';
import {clearHeadCache, parseUrl} from '@/util';
import {hideSplash, showSplash, showSplashError} from '@/util/splash';
import {MutationTypes} from "@/store/mutation-types";
import {LiveAtlasServerDefinition, LiveAtlasUIElement} from "@/index";
Expand Down Expand Up @@ -170,6 +170,7 @@ export default defineComponent({
return;
}
clearHeadCache();
loadingAttempts.value = 0;
window.history.replaceState({}, '', newServer.id);
loadConfiguration();
Expand Down
5 changes: 5 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ const tickHeadQueue = () => {
tickHeadQueue();
}

export const clearHeadCache = () => {
headCache.clear();
headQueue.splice(0);
}

export const parseUrl = (url: URL) => {
const query = new URLSearchParams(url.search),
hash = url.hash.replace('#', '');
Expand Down

0 comments on commit 4535af7

Please sign in to comment.