diff --git a/ng-app/index-web.html b/ng-app/index-web.html
index 893e71f..12b3a4f 100644
--- a/ng-app/index-web.html
+++ b/ng-app/index-web.html
@@ -119,7 +119,7 @@
if (RegExp().hasIndices === undefined) return false;
try {
if (Worker === undefined) return false;
- new Worker(URL.createObjectURL(new Blob(['console.log("webworker ok");'], {type: 'application/javascript'})));
+ new Worker(URL.createObjectURL(new Blob([';'], {type: 'application/javascript'})));
if (typeof WebAssembly === "object"
&& typeof WebAssembly.instantiate === "function") {
const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
diff --git a/ng-app/src/apps/MdSource.svelte b/ng-app/src/apps/MdSource.svelte
index 82da84b..7d50e6d 100644
--- a/ng-app/src/apps/MdSource.svelte
+++ b/ng-app/src/apps/MdSource.svelte
@@ -104,6 +104,7 @@
}
onMount(async ()=>{
+ if (editor) await editor.destroy();
await setup();
});
@@ -112,6 +113,7 @@
ydoc.destroy();
commits.discrete?.deregisterOnUpdate();
if (editor) await editor.destroy();
+ editor = undefined;
});
diff --git a/ng-app/src/apps/MilkDownEditor.svelte b/ng-app/src/apps/MilkDownEditor.svelte
index 51abb81..3e280b7 100644
--- a/ng-app/src/apps/MilkDownEditor.svelte
+++ b/ng-app/src/apps/MilkDownEditor.svelte
@@ -181,7 +181,7 @@
}
onMount(async ()=>{
-
+ if (editor) await editor.destroy();
await setup();
});
@@ -189,6 +189,7 @@
onDestroy(async ()=>{
ydoc.destroy();
if (editor) await editor.destroy();
+ editor = undefined;
});
diff --git a/ng-app/src/apps/PostMdViewer.svelte b/ng-app/src/apps/PostMdViewer.svelte
index 1a4f779..f710c1c 100644
--- a/ng-app/src/apps/PostMdViewer.svelte
+++ b/ng-app/src/apps/PostMdViewer.svelte
@@ -129,6 +129,7 @@
}
onMount(async ()=>{
+ if (editor) await editor.destroy();
await setup();
});
@@ -137,6 +138,7 @@
ydoc.destroy();
try {
if (editor) await editor.destroy();
+ editor = undefined;
} catch(e) {
console.log(e);
}
diff --git a/ng-app/src/apps/YMapEditor.svelte b/ng-app/src/apps/YMapEditor.svelte
index fd097fa..6362536 100644
--- a/ng-app/src/apps/YMapEditor.svelte
+++ b/ng-app/src/apps/YMapEditor.svelte
@@ -254,6 +254,7 @@
onDestroy(async ()=>{
ydoc.destroy();
await editor.destroy();
+ editor = undefined;
});
function onRenderMenu(items, context) {
diff --git a/ng-app/src/apps/YMapViewer.svelte b/ng-app/src/apps/YMapViewer.svelte
index a8e1dea..dfa4b0a 100644
--- a/ng-app/src/apps/YMapViewer.svelte
+++ b/ng-app/src/apps/YMapViewer.svelte
@@ -125,6 +125,7 @@
onDestroy(async ()=>{
ydoc.destroy();
await editor.destroy();
+ editor = undefined;
});
const edit = () => {
diff --git a/ng-app/src/locales/en.json b/ng-app/src/locales/en.json
index 754f8dd..2f4b3c9 100644
--- a/ng-app/src/locales/en.json
+++ b/ng-app/src/locales/en.json
@@ -19,7 +19,7 @@
"pro": "Pro",
"media": "Media",
"chart": "Chart",
- "viz": "Vizualitation",
+ "viz": "Visualization",
"diagram": "Diagram",
"other": "Other file formats",
"data": "Data",
@@ -555,6 +555,7 @@
"DecryptionError": "Error with decryption.",
"InvalidValue": "The value is invalid.",
"ConnectionNotFound": "The connection was not found.",
+ "InvalidSecurityImage": "The security image you chose is not valid.",
"InvalidKey": "The key is invalid.",
"InvalidInvitation": "The invitation is invalid.",
"InvalidCreateAccount": "An error occurred creating the account.",
diff --git a/ng-app/src/store.ts b/ng-app/src/store.ts
index 426add4..34ca089 100644
--- a/ng-app/src/store.ts
+++ b/ng-app/src/store.ts
@@ -17,7 +17,7 @@ import {
} from "svelte/store";
import { register, init, locale, format } from "svelte-i18n";
import ng from "./api";
-import { persistent_error, update_class, update_branch_display, open_branch, tab_update, change_nav_bar, cur_branch, cur_tab, show_modal_create, cur_tab_update, nav_bar,in_memory_save } from "./tab";
+import { persistent_error, update_class, update_branch_display, open_branch, tab_update, change_nav_bar, cur_branch, cur_tab, show_modal_create, save, nav_bar,in_memory_save } from "./tab";
import { encode } from "./base64url";
let all_branches = {};
@@ -47,6 +47,7 @@ init({
export const display_error = (error: string) => {
if (error.message) return error.message;
if (error.includes(" ")) return error;
+ if (error.includes("\"")) return error;
//console.log(error);
// TODO: Check, if error tranlsation does not exist
const parts = error.split(":");
@@ -143,6 +144,7 @@ export const toast_success = (text) => {
}
export const openModalCreate = async () => {
+ await save();
await reset_toasts()
show_modal_create.set(true);
}
@@ -464,6 +466,7 @@ export const sparql_update = async function(sparql:string) {
}
export const branch_subscribe = function(nuri:string, in_tab:boolean) {
+
//console.log("branch_subscribe", nuri)
// const { subscribe, set, update } = writable([]); // create the underlying writable store
@@ -492,12 +495,14 @@ export const branch_subscribe = function(nuri:string, in_tab:boolean) {
// // update,
// };
- open_branch(nuri, in_tab);
-
+
return {
load: async () => {
//console.log("load upper");
+ await save();
+ open_branch(nuri, in_tab);
+
let already_subscribed = all_branches[nuri];
if (!already_subscribed) return;
if (already_subscribed.load) {
@@ -696,7 +701,10 @@ export const branch_subscribe = function(nuri:string, in_tab:boolean) {
});
} else {
console.error(e);
- // TODO: display persistent_error
+ persistent_error(nuri, {
+ title: get(format)("errors.an_error_occurred"),
+ desc: display_error(e)
+ });
}
}
// this is in case decrease has been called before the load function returned.
diff --git a/ng-app/src/tab.ts b/ng-app/src/tab.ts
index cf10c68..65939a5 100644
--- a/ng-app/src/tab.ts
+++ b/ng-app/src/tab.ts
@@ -335,9 +335,11 @@ export const save = async () => {
nav_bar.update((o) => { if (o.save === true) o.save = false; return o; });
if (in_memory_save.length > 0) {
- await in_memory_save_callback(in_memory_save);
+ let temp = in_memory_save;
+ in_memory_save = [];
+ await in_memory_save_callback(temp);
}
- in_memory_save = [];
+
}
export const set_header_in_view = function(val) {
@@ -469,7 +471,8 @@ export const cur_tab_update = function( fn ) {
export const live_editing = writable(false);
-export const showMenu = () => {
+export const showMenu = async () => {
+ await save();
show_modal_menu.set(true);
cur_tab_update(ct => {
ct.show_menu = true;
diff --git a/ng-app/src/workertest.js b/ng-app/src/workertest.js
index 021c582..1c8a0e7 100644
--- a/ng-app/src/workertest.js
+++ b/ng-app/src/workertest.js
@@ -1 +1 @@
-console.log("workertest ok");
\ No newline at end of file
+;
\ No newline at end of file
diff --git a/ng-repo/src/errors.rs b/ng-repo/src/errors.rs
index 0d95217..831f134 100644
--- a/ng-repo/src/errors.rs
+++ b/ng-repo/src/errors.rs
@@ -405,6 +405,7 @@ impl From for VerifierError {
NgError::BranchNotFound => VerifierError::BranchNotFound,
NgError::SerializationError => VerifierError::SerializationError,
NgError::PermissionDenied => VerifierError::PermissionDenied,
+ NgError::VerifierError(e) => e,
// NgError::JsStorageReadError
// NgError::JsStorageWriteError(String)
// NgError::JsStorageKeyNotFound
diff --git a/ng-verifier/src/commits/transaction.rs b/ng-verifier/src/commits/transaction.rs
index 13157b9..c17552d 100644
--- a/ng-verifier/src/commits/transaction.rs
+++ b/ng-verifier/src/commits/transaction.rs
@@ -229,7 +229,10 @@ impl Verifier {
(BranchCrdt::YMap(_), DiscreteTransaction::YMap(v)) => DiscretePatch::YMap(v),
(BranchCrdt::YText(_), DiscreteTransaction::YText(v)) => DiscretePatch::YText(v),
(BranchCrdt::YXml(_), DiscreteTransaction::YXml(v)) => DiscretePatch::YXml(v),
- _ => return Err(VerifierError::InvalidCommit),
+ _ => {
+ //log_debug!("{:?} {:?}", crdt, patch);
+ return Err(VerifierError::InvalidCommit);
+ }
};
self.push_app_response(
branch_id,
diff --git a/ng-verifier/src/verifier.rs b/ng-verifier/src/verifier.rs
index 41ebb08..8ab7dcd 100644
--- a/ng-verifier/src/verifier.rs
+++ b/ng-verifier/src/verifier.rs
@@ -1415,6 +1415,7 @@ impl Verifier {
let broker_id = if as_publisher {
if branch_info.topic_priv_key.is_none() {
// we need to subscribe as publisher, but we cant
+ log_debug!("no topic_priv_key");
return Err(NgError::PermissionDenied);
}
Some(remote_broker.broker_peer_id())
@@ -1990,8 +1991,7 @@ impl Verifier {
repo_id,
Arc::clone(&store),
)
- .await
- .map_err(|e| NgError::BootstrapError(e.to_string()))?;
+ .await?;
let mut store_branch = None;
@@ -2028,8 +2028,7 @@ impl Verifier {
repo_id,
Arc::clone(&store),
)
- .await
- .map_err(|e| NgError::BootstrapError(e.to_string()))?;
+ .await?;
}
}