Workaround for a pouchdb/chrome bug.
This commit is contained in:
parent
0af58ccb4f
commit
ccbcd12f96
|
@ -371,9 +371,12 @@ export const getGpx = async (params: any) => {
|
|||
const docs = await getFamily(id, { include_docs: true });
|
||||
let target: any[];
|
||||
let gpx: Gpx | undefined = undefined;
|
||||
docs.rows.forEach((row: any) => {
|
||||
docs.rows.every((row: any) => {
|
||||
// level 0
|
||||
if (row.doc.type === 'gpx') {
|
||||
if (!!gpx) {
|
||||
return false; // Hack to stop if getFamily fails
|
||||
}
|
||||
target = [row.doc.doc];
|
||||
gpx = row.doc.doc;
|
||||
}
|
||||
|
@ -394,6 +397,7 @@ export const getGpx = async (params: any) => {
|
|||
appendToArray(target.at(-1), row.doc.type, row.doc._id);
|
||||
target.push(row.doc.doc);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return gpx;
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ export const getFamily = async (
|
|||
const targetDb = local ? localDb : db;
|
||||
return await targetDb.allDocs({
|
||||
startkey: key,
|
||||
endkey: key + '\ufff0',
|
||||
endkey: `${key}\ufff0`,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
|
|
@ -37,9 +37,12 @@ export const getRte = async (params: any) => {
|
|||
const docs = await getFamily(id, { include_docs: true });
|
||||
let target: any[];
|
||||
let rte: Rte | undefined = undefined;
|
||||
docs.rows.forEach((row: any) => {
|
||||
docs.rows.every((row: any) => {
|
||||
// level 0
|
||||
if (row.doc.type === 'rte') {
|
||||
if (!!rte) {
|
||||
return false; // Hack to stop if getFamily fails
|
||||
}
|
||||
target = [row.doc.doc];
|
||||
rte = row.doc.doc;
|
||||
}
|
||||
|
@ -50,6 +53,7 @@ export const getRte = async (params: any) => {
|
|||
appendToArray(target.at(-1), row.doc.type, row.doc.doc);
|
||||
target.push(row.doc.doc);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return rte;
|
||||
};
|
||||
|
|
|
@ -37,9 +37,12 @@ export const getTrk = async (params: any) => {
|
|||
const docs = await getFamily(id, { include_docs: true });
|
||||
let target: any[];
|
||||
let trk: Trk | undefined = undefined;
|
||||
docs.rows.forEach((row: any) => {
|
||||
docs.rows.every((row: any) => {
|
||||
// level 0
|
||||
if (row.doc.type === 'trk') {
|
||||
if (!!trk) {
|
||||
return false; // Hack to stop if getFamily fails
|
||||
}
|
||||
target = [row.doc.doc];
|
||||
trk = row.doc.doc;
|
||||
}
|
||||
|
@ -49,6 +52,7 @@ export const getTrk = async (params: any) => {
|
|||
appendToArray(target.at(-1), row.doc.type, row.doc._id);
|
||||
target.push(row.doc.doc);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return trk;
|
||||
};
|
||||
|
|
|
@ -32,9 +32,12 @@ export const getTrkseg = async (params: any) => {
|
|||
const docs = await getFamily(id, { include_docs: true });
|
||||
let target: any[];
|
||||
let trkseg: Trkseg | undefined = undefined;
|
||||
docs.rows.forEach((row: any) => {
|
||||
docs.rows.every((row: any) => {
|
||||
// level 0
|
||||
if (row.doc.type === 'trkseg') {
|
||||
if (!!trkseg) {
|
||||
return false; // Hack to stop if getFamily fails
|
||||
}
|
||||
target = [row.doc.doc];
|
||||
trkseg = row.doc.doc;
|
||||
}
|
||||
|
@ -45,6 +48,7 @@ export const getTrkseg = async (params: any) => {
|
|||
appendToArray(target.at(-1), row.doc.type, row.doc.doc);
|
||||
target.push(row.doc.doc);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return trkseg;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue