fix: undo/redo prevents use of unknown actions

This commit is contained in:
2023-12-02 19:31:46 +01:00
parent f9cdf70bdb
commit 5c06c2206c
2 changed files with 40 additions and 35 deletions

View File

@@ -4,31 +4,37 @@
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils, rust-overlay }: outputs = {
flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
overlays = [ (import rust-overlay) ]; flake-utils,
pkgs = import nixpkgs { inherit system overlays; }; rust-overlay,
rust-bin = pkgs.rust-bin.stable.latest.default.override { }:
extensions = [ "rust-src" "rust-std" "clippy" "rust-analyzer" ]; flake-utils.lib.eachDefaultSystem (system: let
}; overlays = [(import rust-overlay)];
fontMin = (pkgs.python311.withPackages(ps: with ps; [ brotli fonttools ] ++ (with fonttools.optional-dependencies; [ woff ]))); pkgs = import nixpkgs {inherit system overlays;};
tauriPkgs = nixpkgs.legacyPackages.${system}; rust-bin = pkgs.rust-bin.stable.latest.default.override {
libraries = with tauriPkgs; [ extensions = ["rust-src" "rust-std" "clippy" "rust-analyzer"];
webkitgtk };
gtk3 fontMin = pkgs.python311.withPackages (ps: with ps; [brotli fonttools] ++ (with fonttools.optional-dependencies; [woff]));
cairo tauriPkgs = nixpkgs.legacyPackages.${system};
gdk-pixbuf libraries = with tauriPkgs; [
glib webkitgtk
dbus gtk3
openssl_3 cairo
librsvg gdk-pixbuf
]; glib
packages = (with pkgs; [ dbus
openssl_3
librsvg
];
packages =
(with pkgs; [
nodejs_18 nodejs_18
rust-bin rust-bin
fontMin fontMin
]) ++ (with tauriPkgs; [ ])
++ (with tauriPkgs; [
curl curl
wget wget
pkg-config pkg-config
@@ -39,16 +45,15 @@
libsoup libsoup
webkitgtk webkitgtk
librsvg librsvg
# serial plugin # serial plugin
udev udev
]); ]);
in in {
{ devShell = pkgs.mkShell {
devShell = pkgs.mkShell { buildInputs = packages;
buildInputs = packages; shellHook = ''
shellHook = '' export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH '';
''; };
}; });
});
} }

View File

@@ -100,7 +100,7 @@ export const chords = derived([overlay, deviceChords], ([overlay, chords]) => {
return { return {
id: chord.actions, id: chord.actions,
// use the old phrase for stable editing // use the old phrase for stable editing
sortBy: chord.phrase.map(it => KEYMAP_CODES[it].id || it).join(), sortBy: chord.phrase.map(it => KEYMAP_CODES[it]?.id ?? it).join(),
actions: changedChord.actions, actions: changedChord.actions,
phrase: changedChord.phrase, phrase: changedChord.phrase,
actionsChanged: id !== JSON.stringify(changedChord.actions), actionsChanged: id !== JSON.stringify(changedChord.actions),
@@ -110,7 +110,7 @@ export const chords = derived([overlay, deviceChords], ([overlay, chords]) => {
} else { } else {
return { return {
id: chord.actions, id: chord.actions,
sortBy: chord.phrase.map(it => KEYMAP_CODES[it].id || it).join(), sortBy: chord.phrase.map(it => KEYMAP_CODES[it]?.id ?? it).join(),
actions: chord.actions, actions: chord.actions,
phrase: chord.phrase, phrase: chord.phrase,
phraseChanged: false, phraseChanged: false,