Skip to content

Commit

Permalink
Merge pull request #626 from ZenUml/fix-reload-issue
Browse files Browse the repository at this point in the history
Fix reload different diagram issue by removing image blob generation in saveCode
  • Loading branch information
MrCoder authored Nov 27, 2023
2 parents f2dc7a5 + ede5378 commit 7c03411
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,6 @@ BookLibService.Borrow(id) {
}

async saveCode(key) {
const imageBlob = await this.contentWrap.getPngBlob();

this.state.currentItem.imageBase64 = await blobToBase64(imageBlob);
this.state.currentItem.updatedOn = Date.now();
this.state.currentItem.layoutMode = this.state.currentLayoutMode;

Expand All @@ -769,7 +766,9 @@ BookLibService.Borrow(id) {

try {
const result = await syncDiagram(this.state.currentItem);
this.state.currentItem.shareLink = getShareLink(result);
if(result) {
this.state.currentItem.shareLink = getShareLink(result);
}
} catch (e) {
console.error(e);
}
Expand Down
5 changes: 5 additions & 0 deletions src/services/syncService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import firebase from 'firebase/app';

async function syncDiagram(currentItem) {
if(location.host === 'localhost:8080') {
console.log('!! Skipping sync-diagram call in local environment');
return;
}

const { id, title, js, imageBase64 } = currentItem;
if (!js || !title || !imageBase64) {
throw Error('Cannot sync diagram because of missing data');
Expand Down

0 comments on commit 7c03411

Please sign in to comment.