Don't use useGeographic anymore since it doesn't work with clusters.
This commit is contained in:
1 parent
6e796f88c7
commit
9ade878deb
6 files changed
+69
-51
No files matched your search
+11
-5
@@ -14,29 +14,35 @@ export const put = async (
|
||||
) => {
|
||||
const targetDb = local ? localDb : db;
|
||||
let current;
|
||||
let putDoc;
|
||||
try {
|
||||
current = await targetDb.get(_id);
|
||||
} catch {
|
||||
current = { _rev: undefined, doc: cloneDeep(defaultDoc) };
|
||||
}
|
||||
try {
|
||||
await targetDb.put({
|
||||
putDoc = {
|
||||
_id,
|
||||
_rev: current._rev,
|
||||
type,
|
||||
doc: update(current.doc),
|
||||
});
|
||||
};
|
||||
await targetDb.put(putDoc);
|
||||
} catch (error: any) {
|
||||
if (error.name === 'conflict') {
|
||||
console.log({ caller: 'db.put', _id, type, defaultDoc, error });
|
||||
console.log({ caller: 'db.put', _id, type, putDoc, defaultDoc, error });
|
||||
await put(_id, type, update, defaultDoc, local);
|
||||
} else {
|
||||
console.error({ caller: 'db.put', _id, type, defaultDoc, error });
|
||||
console.error({ caller: 'db.put', _id, type, putDoc, defaultDoc, error });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const getFamily = async (key: string, options: any = {}, local: boolean = false) => {
|
||||
export const getFamily = async (
|
||||
key: string,
|
||||
options: any = {},
|
||||
local: boolean = false
|
||||
) => {
|
||||
const targetDb = local ? localDb : db;
|
||||
return await targetDb.allDocs({
|
||||
startkey: key,
|
||||
|
||||
Reference in new issue
Block a user