hql287 / Manta

🎉 Flexible invoicing desktop app with beautiful & customizable templates.
https://www.getmanta.app
GNU Lesser General Public License v3.0
5.28k stars 476 forks source link

PouchDB Problem #228

Closed ghost closed 6 years ago

ghost commented 6 years ago

Is it a bug or a feature request?

Which version are you using?

Which is the version/distribution of the OS?

Describe your issue

Steps to replicate

Additional infos

Any idea what might be the problem? i looked for myself, but i have little experience with react or pouchdb, so i dont really know where to start. on the other side, i have a frontend dev background, so maybe i can help fix it ... or help with some features, as soon as i get it running :)

i really like the direction of manta, i was literally planning something like this for myself, for almost the same reasons, then i read about your app in the codrops newsletter. perfect timing, thanks!

ghost commented 6 years ago

Seems to be a Problem with electron, indexdb is not reachable. if i create a indexeddb database in the devtools console (of the eclectron manta app) with indexedDB.open("test");, i get the following error:

IDBOpenDBRequest {onblocked: null, onupgradeneeded: null, source: null, transaction: null, readyState: "pending"…}
error: DOMException: Internal error opening backing store for indexedDB.open.
code: 0
message: "Internal error opening backing store for indexedDB.open."
name: "UnknownError"

Creating a indexeddb in Chromium works fine. So i guess it's something with electron.

ghost commented 6 years ago

Ok, i found the reason, why indexeddb is not reachable, but not the why. The AppImage package is causing this. I restarted the OS and all worked fine after launching the app with yarn. After that i closed the yarn instance and opened the appimage version. And indexeddb access was broken again. Also in the yarn instance, i opened after i closed the appimage instance.

ghost commented 6 years ago

Same Problem with the .deb package ...

How can i debug a packaged version of the app?

hql287 commented 6 years ago

Hi @jens-t , my apologies for this inconvenience. A couple of questions:

ghost commented 6 years ago

The Version of the App packages i tested was 1.1.2 ... (appimage/deb) And yes, I can use the app with the dev server without any problems, as long as there runs no packaged app before or in parallel.

As soon as i can test a self exported package, i post the results.

ghost commented 6 years ago

Ok, i've tested the "self build versions", same Problem with .deb & .appimage ... I investigte further. Found some electron debug tools that should help. devtron is already installed. electron-debug in combination with devtron & electron-react-devtools seems good to me.

ghost commented 6 years ago

Tested the linux packages with forced devtools. The problem seems to be that the app is not properly closing on its own. so if you open the app the second time indexeddb is blocked by the app opened before running in the background. if i start the app from the terminal, i can kill the app completely, stat it a second time and everything is fine.

Don't know yet why the app is not closing properly over the ui ...

Edit: If i close the app with "Invoice -> Quit App" or "CTRL + Q" the app is really closed. only the window close button is causing this ...

Edit2: Ok, found the part thats causing this. I send a pull request ...

hql287 commented 6 years ago

@jens-t Ok this confirms it.

The pouchDB document is not very helpful on this but from my experience, when this issue comes up, 99% of the time it has something to do with multiple instances of the app is running so one of them cann't connect properly. So if you run the dev server and then open the exported app, the same issue would show up.

hql287 commented 6 years ago

Since we found the culprit, I guess this has more to do with the way Manta works rather than pouchDB. Feel free to change the title to something more relevant, or close the issue and open a new one if you want. Thanks!

ghost commented 6 years ago

Closing this ticket, followup in ticket #233 .