pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.33k stars 140 forks source link

Adding a SQL State Storage instead of IndexedDB #917

Closed mauricioszabo closed 1 month ago

mauricioszabo commented 9 months ago

Will fix https://github.com/pulsar-edit/pulsar/issues/531

Needs:

DeeDeeG commented 8 months ago

Does this need some more input from other folks? Is this ready for wider use? Would it be welcome for someone to grab a build of this branch and test a few things?

I don't mean to leave this PR open without responding to it, so seeing if I can be of help.

mauricioszabo commented 8 months ago

Yeah, I think the:

Some migration to the SQL version (so we don't lose things)

Can be done in a different branch :)

mauricioszabo commented 8 months ago

Translating: sure, let's merge it if it's ok with more people

DeeDeeG commented 7 months ago

I think I should test-drive this before moving to merge it.

Anything in particular I should try? Just loading up a bunch of windows with lots of tabs, and shutting down then reopening and reloading Pulsar a bunch of times? Open and close a lot of tabs, stuff like that?

Would there be anything in particular that would best show it is working?

mauricioszabo commented 7 months ago

Yes, @DeeDeeG, that's right. Don't forget to toggle the option in the config.

Although, I've been test-driving this for a while, and so far, I found no problems...

DeeDeeG commented 7 months ago

I found an issue using this branch's binary on macOS.

Steps to reproduce:

Expected:

Actual (issue):

Full error message and stack trace (click to expand): ``` index.js:83 Error: Could not find module root given file: "/private/var/folders/rd/9ccg_bdj4v949y62zjrcv9100000gn/T/AppTranslocation/DB1EBBAB-5A9A-46D9-95DD-62EE4404113E/d/Pulsar.app/Contents/Resources/app.asar/node_modules/bindings/bindings.js". Do you have a `package.json` file? at Function.getRoot (/private/var/folders…ngs/bindings.js:211) at bindings (/private/var/folders…ings/bindings.js:82) at Object. (/private/var/folders…qlite3-binding.js:1) at Object. (/private/var/folders…qlite3-binding.js:3) at Module._compile (/private/var/folders…ompile-cache.js:120) at Object.value [as .js] (/Applications/Pulsar…ompile-cache.js:252) at Module.load (internal/modules/cjs/loader.js:935) at Module._load (internal/modules/cjs/loader.js:776) at Function.f._load (electron/js2c/asar_bundle.js:5) at Function.o._load (electron/js2c/renderer_init.js:33) at Module.require (internal/modules/cjs/loader.js:959) at require (/private/var/folders…compile-cache.js:67) at Object. (/private/var/folders…e3/lib/sqlite3.js:2) at Object. (/private/var/folders…/lib/sqlite3.js:209) at Module._compile (/private/var/folders…ompile-cache.js:120) at Object.value [as .js] (/Applications/Pulsar…ompile-cache.js:252) at Module.load (internal/modules/cjs/loader.js:935) at Module._load (internal/modules/cjs/loader.js:776) at Function.f._load (electron/js2c/asar_bundle.js:5) at Function.o._load (electron/js2c/renderer_init.js:33) at Module.require (internal/modules/cjs/loader.js:959) at require (/private/var/folders…compile-cache.js:67) at Object. (/private/var/folders…tate-store/sql.js:3) at Object. (/private/var/folders…te-store/sql.js:119) at Module._compile (/private/var/folders…ompile-cache.js:120) at Object.value [as .js] (/Applications/Pulsar…ompile-cache.js:252) at Module.load (internal/modules/cjs/loader.js:935) at Module._load (internal/modules/cjs/loader.js:776) at Function.f._load (electron/js2c/asar_bundle.js:5) at Function.o._load (electron/js2c/renderer_init.js:33) handleSetupError | @ | index.js:83 ```

Maybe Pulsar is looking for core Pulsar files in the wrong place, at the old stale "AppTranslocation" path from previous launch? (AppTranslocation dir is different every launch as a security measure for .apps launched from outside the /Applications dir, I think?

These steps to reproduce do not have the issue on Pulsar Rolling 115, and I think the issue doesn't happen if the "Untitled" file doesn't have any semicolons typed in it. So, maybe it's just a matter of escaping some semicolons, sanitizing inputs? Hmmm.

mauricioszabo commented 7 months ago

Seems like a sqlite.js NPM module error, really... maybe it's not finding the right directory for the SQLite binary...