refactor hacky tracking to solid primitive

This commit is contained in:
Chris Kruining 2025-02-25 22:44:06 +11:00
parent 789d14330a
commit 44549c36be
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
5 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import { trackStore } from "@solid-primitives/deep";
import { Accessor, createEffect, createMemo, untrack } from "solid-js";
import { createStore } from "solid-js/store";
import { CustomPartial } from "solid-js/store/types/store.js";
@ -93,8 +94,7 @@ export const createDataSet = <T extends Record<string, any>>(data: Accessor<T[]>
});
const mutations = createMemo(() => {
// enumerate all values to make sure the memo is recalculated on any change
Object.values(state.value).map(entry => Object.values(entry ?? {}));
trackStore(state.value);
return deepDiff(state.snapshot, state.value).toArray();
});

View file

@ -35,7 +35,7 @@
"newKey": {
"title": "Which key do you want to create?",
"placeholder": "Name of the new key",
"description": "Hint: use `.` to denote nested keys,\ni.e. `this.is.some.key` would be a key that is four levels deep."
"description": "Hint: use `.` to denote nested keys,\n\ni.e. `this.is.some.key` would be a key that is four levels deep."
},
"newLanguage": {
"title": "Which language do you want to add?",
@ -51,4 +51,4 @@
}
}
}
}
}

View file

@ -35,7 +35,7 @@
"newKey": {
"title": "Welke sleutel wil je toevoegen?",
"placeholder": "Naam van de nieuwe sleutel",
"description": "Hint: gebruik een `.` voor geneste sleutels,\nbijv. `this.is.some.key` is een sleutel die vier lagen diep is."
"description": "Hint: gebruik een `.` voor geneste sleutels,\n\nbijv. `this.is.some.key` is een sleutel die vier lagen diep is."
},
"newLanguage": {
"title": "Welke taal wil je toevoegen?",
@ -51,4 +51,4 @@
}
}
}
}
}