Switch back to static again, issue was caused by improper null guarding on localstorage
This commit is contained in:
parent
6f647cb793
commit
d89b108e6d
4 changed files with 30 additions and 124 deletions
src/routes
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
})
|
||||
|
||||
let gravity = $state(1.00);
|
||||
let gravity = $state(1);
|
||||
$effect(() => {
|
||||
if (mounted) {
|
||||
localStorage.setItem("gravity", gravity);
|
||||
|
@ -159,37 +159,39 @@
|
|||
locale = navigator.language;
|
||||
}
|
||||
let localThrusters = localStorage.getItem("thrusters");
|
||||
if (typeof localThrusters !== "undefined" && localThrusters !== "") {
|
||||
if (typeof localThrusters !== "undefined" && localThrusters !== "" && localGravity != null) {
|
||||
thrusters = JSON.parse(localThrusters);
|
||||
}
|
||||
|
||||
let localInventories = localStorage.getItem("inventories");
|
||||
if (typeof localInventories !== "undefined" && localInventories !== "") {
|
||||
if (typeof localInventories !== "undefined" && localInventories !== "" && localGravity != null) {
|
||||
inventories = JSON.parse(localInventories);
|
||||
}
|
||||
|
||||
let localGridSize = localStorage.getItem("gridSize");
|
||||
if (typeof localGridSize !== "undefined" && localGridSize !== "") {
|
||||
if (typeof localGridSize !== "undefined" && localGridSize !== "" && localGravity != null) {
|
||||
gridSize = localGridSize;
|
||||
}
|
||||
|
||||
console.log(gravity);
|
||||
let localGravity = localStorage.getItem("gravity");
|
||||
if (typeof localGravity !== "undefined" && localGravity !== "") {
|
||||
if (typeof localGravity !== "undefined" && localGravity !== "" && localGravity != null) {
|
||||
console.log(localGravity);
|
||||
gravity = localGravity;
|
||||
}
|
||||
|
||||
let localInventoryMultiplicator = localStorage.getItem("inventoryMultiplier");
|
||||
if (typeof localInventoryMultiplicator !== "undefined" && localInventoryMultiplicator !== "") {
|
||||
if (typeof localInventoryMultiplicator !== "undefined" && localInventoryMultiplicator !== "" && localGravity != null) {
|
||||
inventoryMultiplier = localInventoryMultiplicator;
|
||||
}
|
||||
|
||||
let localNewThruster = localStorage.getItem("newThruster");
|
||||
if (typeof localNewThruster !== "undefined" && localNewThruster !== "") {
|
||||
if (typeof localNewThruster !== "undefined" && localNewThruster !== "" && localGravity != null) {
|
||||
newThruster = JSON.parse(localNewThruster);
|
||||
}
|
||||
|
||||
let localNewInventory = localStorage.getItem("newInventory");
|
||||
if (typeof localNewInventory !== "undefined" && localNewInventory !== "") {
|
||||
if (typeof localNewInventory !== "undefined" && localNewInventory !== "" && localGravity != null) {
|
||||
newInventory = JSON.parse(localNewInventory);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue