convex icon indicating copy to clipboard operation
convex copied to clipboard

`Convex.acquire` uses `Stores.current()` as default

Open helins opened this issue 4 years ago • 1 comments

This is counter-intuitive because Convex.create() accepts an optional store. Hence, it is expected that the user given one would be used as default store.

A side effect is that when you call directly acquireState(), it tries to resolve refs relative to the thread-local store instead of using the user given one at .create().

I think no method on Convex should accept a store but .create() for setting the default one. What do you think?

helins avatar Aug 30 '21 15:08 helins

Acquire probably only makes sense if you want to acquire the data for the store you are using in the current thread?

In general, all the Convex methods assume you are using the correct store on the current thread. The optional store argument is possibly not even required.

mikera avatar Aug 31 '21 21:08 mikera