Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed Oct 9, 2024
1 parent f9af742 commit 91dc867
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 0 additions & 12 deletions src/components/dialogs/formSelections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,3 @@ export default class FormSelections {
twitter = new TwitterSelections();
wiki = new WikiSelections();
}

export function getFormSelections() {
try {
if (sessionStorage.getItem('form')) {
return JSON.parse(sessionStorage.getItem('form')!) as FormSelections;
}
return new FormSelections();
} catch {
sessionStorage.removeItem('form');
return new FormSelections();
}
}
14 changes: 13 additions & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { get, writable } from 'svelte/store';
import { NavMode } from './components/chartUtils';
import DataSet, { DataGroup } from './data/DataSet';
import deriveLinkDefaults, { getDirectLinkImpl } from './deriveLinkDefaults';
import { getFormSelections } from './components/dialogs/formSelections';
import FormSelections from './components/dialogs/formSelections';

declare const __VERSION__: string;

Expand All @@ -18,6 +18,18 @@ export const isShowingPoints = writable(defaults.showPoints);
export const initialViewport = writable(defaults.viewport);
export const navMode = writable(NavMode.autofit);

export function getFormSelections() {
try {
if (sessionStorage.getItem('form')) {
return JSON.parse(sessionStorage.getItem('form')!) as FormSelections;
}
return new FormSelections();
} catch {
sessionStorage.removeItem('form');
return new FormSelections();
}
}

export const formSelections = writable(getFormSelections());
formSelections.subscribe((val) => {
sessionStorage.setItem('form', JSON.stringify(val));
Expand Down

0 comments on commit 91dc867

Please sign in to comment.