AlexDunmow / y-supabase

Supabase Provider for Yjs
MIT License
118 stars 14 forks source link

Error handling suggestions #7

Open samghelms opened 10 months ago

samghelms commented 10 months ago

First of all, thank you so much for sharing this! Incredible work.

FYI, I found it helpful to add this.on('error', this.onDisconnect); to the constructor. Without it, I was running into issues reconnecting after closing/reopening webpages.

I also had to change removeSelfFromAwarenessOnUnload to handle some errors disconnecting.

removeSelfFromAwarenessOnUnload = () => {
    awarenessProtocol.removeAwarenessStates(this.awareness, [this.doc.clientID], 'window unload');
  }