re-frame

roklenarcic 2025-10-25T16:02:20.833659Z

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?

p-himik 2025-10-25T16:05:15.212479Z

I'd create a new effect that accepts other events for errors and successes. Similar to how various AJAX effects work.

roklenarcic 2025-10-25T16:05:42.317749Z

basically you chain into another dispatch?

p-himik 2025-10-25T16:06:14.423469Z

Yes. Also, local storage is not async. So maybe you meant something else.

p-himik 2025-10-25T16:06:39.756879Z

> you chain into another dispatch? But via an effect - not inside an event handler, of course.

roklenarcic 2025-10-25T16:07:11.727359Z

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

roklenarcic 2025-10-25T16:07:16.941609Z

so it’s async in a way

p-himik 2025-10-25T16:08:11.709589Z

That's probably IndexedDB. Local storage is a completely separate concept, and it is synchronous. But anyhow, that's just an unimportant detail.

roklenarcic 2025-10-25T16:30:14.515879Z

ah yes it is indexedDB