This is a follow up on https://github.com/gmodena/nix-flatpak/pull/24#issuecomment-1917639479. I looked into it and turns out I actually already implemented it correctly for overrides, using fallback values in jq (i.e. null // [] and null // {}), so that bug shouldn't occur there. But I think it's also worth implementing it that way for uninstalls, as it's a bit more resilient than comparing old state to an empty object. F.e. if the old state is not an empty object, but is missing the "packages" key for some reason, this would still work (as opposed to the current solution). It's not really necessary right now, but it might avoid bugs in the future.
This is a follow up on https://github.com/gmodena/nix-flatpak/pull/24#issuecomment-1917639479. I looked into it and turns out I actually already implemented it correctly for overrides, using fallback values in
jq
(i.e.null // []
andnull // {}
), so that bug shouldn't occur there. But I think it's also worth implementing it that way for uninstalls, as it's a bit more resilient than comparing old state to an empty object. F.e. if the old state is not an empty object, but is missing the "packages" key for some reason, this would still work (as opposed to the current solution). It's not really necessary right now, but it might avoid bugs in the future.