Hide intermediate button should follow url

This commit is contained in:
Martin Berg Alstad 2023-03-06 21:32:33 +01:00 committed by GitHub
parent 191ba2c793
commit e6dc365632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ type Option = { name: string, value: "NONE" | "TRUE" | "FALSE" | "DEFAULT" | "TR
const TruthTablePage: Component = () => {
let searchParams: URLSearchParams;
let simplifyDefault = true, inputContent = false;
let simplifyDefault = true, inputContent = false, hideIntermediate = false;
if (typeof location !== "undefined") {
searchParams = new URLSearchParams(location.search);
@ -41,7 +41,9 @@ const TruthTablePage: Component = () => {
if (searchParams.has("exp")) {
inputContent = true;
}
}
if (searchParams.has("hideIntermediate")) {
hideIntermediate = searchParams.get("hideIntermediate") === "true";
} }
/**
* Stores the boolean value of the simplify toggle
@ -72,7 +74,7 @@ const TruthTablePage: Component = () => {
const [sortValues, setSortValues] = createSignal(sortOptions[0]);
const [hideIntermediates, setHideIntermediates] = createSignal(false);
const [hideIntermediates, setHideIntermediates] = createSignal(hideIntermediate);
const [isLoaded, setIsLoaded] = createSignal<boolean | null>(null);
@ -153,10 +155,6 @@ hideIntermediate=${ hideIntermediates() }`)
if (sort) {
setSortValues(sortOptions.find(o => o.value === sort) ?? sortOptions[0]);
}
const hideIntermediate = searchParams.get("hideIntermediate");
if (hideIntermediate) {
setHideIntermediates(hideIntermediate === "true");
}
getFetchResult(exp);
}