I am trying to access local storage in my event handler (or I will pass it via interceptor). Regardless of what I do here, the problem is that local storage is async with operations. The return of operation has onerror and onsuccess callback fields. But I need to return the new DB value from the event. Is there any other way to operate that except to make onsuccess handler dispatch another event asynchornously?
I'd create a new effect that accepts other events for errors and successes. Similar to how various AJAX effects work.
basically you chain into another dispatch?
Yes. Also, local storage is not async. So maybe you meant something else.
> you chain into another dispatch? But via an effect - not inside an event handler, of course.
well when you call .get on object store you don’t get the value you get this object that you need to set callbacks on
so it’s async in a way
That's probably IndexedDB. Local storage is a completely separate concept, and it is synchronous. But anyhow, that's just an unimportant detail.
ah yes it is indexedDB