Browse Source

don't export 0s for undefined values!

qrcode-reboot
Trent Larson 18 hours ago
parent
commit
295a2d9f63
  1. 15
      src/components/DataExportSection.vue

15
src/components/DataExportSection.vue

@ -131,7 +131,20 @@ export default class DataExportSection extends Vue {
*/
public async exportDatabase() {
try {
const blob = await db.export({ prettyJson: true });
const blob = await db.export({
prettyJson: true,
transform: (table, value, key) => {
if (table === "contacts") {
// Dexie inserts a number 0 when some are undefined, so we need to totally remove them.
Object.keys(value).forEach(prop => {
if (value[prop] === undefined) {
delete value[prop];
}
});
}
return { value, key };
},
});
const fileName = `${db.name}-backup.json`;
if (this.platformCapabilities.hasFileDownload) {

Loading…
Cancel
Save