Skip to content

Commit

Permalink
Merge pull request #185 from nautls/fix-old-storage-migration
Browse files Browse the repository at this point in the history
Fix `localStorage` migration
  • Loading branch information
arobsn committed Aug 13, 2024
2 parents a95d17b + 4801d01 commit e961a3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nautilus-wallet",
"version": "0.13.0-beta.2",
"version": "0.13.0-beta.3",
"private": true,
"type": "module",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/appStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useAppStore = defineStore("app", () => {
if (!settings.value.isKyaAccepted && privateState.wallets.length > 0) {
const oldSettings = localStorage.getItem("settings");
if (oldSettings) {
settings.value = JSON.parse(oldSettings); // migrate settings
settings.value = { ...DEFAULT_SETTINGS, ...JSON.parse(oldSettings) }; // migrate settings
localStorage.clear(); // clear old settings
} else {
settings.value = {
Expand Down
4 changes: 3 additions & 1 deletion src/stores/assetsStore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { acceptHMRUpdate, defineStore } from "pinia";
import { computed, onMounted, shallowReactive, watch } from "vue";
import { ensureDefaults, uniq } from "@fleet-sdk/common";
import { ensureDefaults, isEmpty, uniq } from "@fleet-sdk/common";
import { useAppStore } from "./appStore";
import { assetInfoDbService } from "@/database/assetInfoDbService";
import { graphQLService } from "@/chains/ergo/services/graphQlService";
Expand Down Expand Up @@ -90,6 +90,8 @@ export const useAssetsStore = defineStore("assets", () => {

const blacklist = computed(() => {
let tokenIds = [] as string[];
if (isEmpty(privateState.blacklist)) return tokenIds;

for (const listName of app.settings.blacklistedTokensLists) {
const list = privateState.blacklist[listName as keyof ErgoTokenBlacklist];
if (Array.isArray(list) && list.length > 0) tokenIds = tokenIds.concat(list);
Expand Down

0 comments on commit e961a3c

Please sign in to comment.