arj03 / ssb-browser-core

ssb-server in a browser
Other
50 stars 8 forks source link

Fix issue where simple-ebt relied on a global SSB object #34

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

Found during work on https://github.com/arj03/ssb-browser-demo/pull/260

arj03 commented 3 years ago

Good find!

KyleMaas commented 3 years ago

Well, it's a find. I can't say it's good. Turns out it doesn't actually function correctly.

KyleMaas commented 3 years ago

Actually, maybe it does. I think I'm just some triggering EBT to run before the SSB object has an "events" key.

KyleMaas commented 3 years ago

Ah. I think I found it. This change should be correct. It's just that with a timeout of 500ms in the new version of the concurrency stuff, it's actually somehow trying to initialize things before the WASM load callback is triggered, which means that things get started out of order. So...yeah. This merged pull request should be fine.

KyleMaas commented 3 years ago

Nope, this does not actually work. sbot is a SecretStack object, and events is a non-standard property of SSB which is added by ssb-browser-core. This problem's a lot more complicated than this little change would actually fix. So I think I'm going to revert this change and delete the branch. This is going to take a bit of work to actually fix right.