Add check for database query
This commit is contained in:
parent
1414080db6
commit
88c165d5ab
@ -86,7 +86,7 @@ function ImportExportModal({
|
||||
}
|
||||
}
|
||||
const toastMessage = <span>{message} <b>{text}</b></span>
|
||||
addToast(toastMessage, {appearance: "warning", autoDismiss: true });
|
||||
addToast(toastMessage, { appearance: "warning", autoDismiss: true });
|
||||
}
|
||||
|
||||
function openFileDialog() {
|
||||
@ -123,7 +123,7 @@ function ImportExportModal({
|
||||
} catch (e) {
|
||||
setIsLoading(false);
|
||||
backgroundTaskRunningRef.current = false;
|
||||
if (e instanceof(Error)) {
|
||||
if (e instanceof (Error)) {
|
||||
if (e.message.startsWith("Max buffer length exceeded")) {
|
||||
setError(
|
||||
new Error(
|
||||
@ -201,7 +201,9 @@ function ImportExportModal({
|
||||
let newTokens: Token[] = [];
|
||||
if (checkedTokens.length > 0) {
|
||||
const tokenIds = checkedTokens.map((token) => token.id);
|
||||
const tokensToAdd: Token[] = await importDB.table<Token>("tokens").bulkGet(tokenIds);
|
||||
const tokensToAdd: Token[] | undefined = await importDB.table<Token>("tokens").bulkGet(tokenIds);
|
||||
|
||||
if (tokensToAdd) {
|
||||
for (let token of tokensToAdd) {
|
||||
if (token) {
|
||||
// Generate new ids
|
||||
@ -235,6 +237,7 @@ function ImportExportModal({
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let newMaps: Map[] = [];
|
||||
let newStates: MapState[] = [];
|
||||
@ -456,7 +459,7 @@ function ImportExportModal({
|
||||
saveAs(blob, `${shortid.generate()}.owlbear`);
|
||||
addSuccessToast("Exported", checkedMaps.length, checkedTokens.length);
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof(Error)) {
|
||||
if (e instanceof (Error)) {
|
||||
console.error(e);
|
||||
setError(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user