You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it receives a response from Backend, a requestData resource by default simply stores the response data. However, the resource can first transform the data by specifying a transformResponse() function. transformResponse() can be used to make the data fully or partly reactive. By default, the data is not reactive.
All that works well in production. However, we use Pinia in limited ways in development, and things don't always end up working. If transformResponse() returns a nonreactive object, then the Pinia store will store that. If transformResponse() returns a shallowReactive() object, then Pinia will correctly store that. However, if transformResponse() returns a fully reactive() object, then getting the data from the store returns a nonreactive object (!).
I'm not quite sure why that is. I suspect it has something to do with the fact that the initial state passed to the Pinia store is shallowReactive(), not reactive(). Just a guess, but it's possible that Pinia doesn't offer a lot of support for shallowReactive() objects.
Again, everything works as expected in production (without Pinia). This hasn't come up before in development because most data isn't reactive, and the data that is is usually shallowReactive(). However, I'm now making the entity resource fully reactive and have been running into issues. For now, I'll turn off Pinia in development, matching what happens in production.
The text was updated successfully, but these errors were encountered:
When it receives a response from Backend, a
requestData
resource by default simply stores the response data. However, the resource can first transform the data by specifying atransformResponse()
function.transformResponse()
can be used to make the data fully or partly reactive. By default, the data is not reactive.All that works well in production. However, we use Pinia in limited ways in development, and things don't always end up working. If
transformResponse()
returns a nonreactive object, then the Pinia store will store that. IftransformResponse()
returns ashallowReactive()
object, then Pinia will correctly store that. However, iftransformResponse()
returns a fullyreactive()
object, then getting the data from the store returns a nonreactive object (!).I'm not quite sure why that is. I suspect it has something to do with the fact that the initial state passed to the Pinia store is
shallowReactive()
, notreactive()
. Just a guess, but it's possible that Pinia doesn't offer a lot of support forshallowReactive()
objects.Again, everything works as expected in production (without Pinia). This hasn't come up before in development because most data isn't reactive, and the data that is is usually
shallowReactive()
. However, I'm now making theentity
resource fully reactive and have been running into issues. For now, I'll turn off Pinia in development, matching what happens in production.The text was updated successfully, but these errors were encountered: