Tested valtio versions: 1.9.0, 1.10.0, 1.10.1, 1.10.2. This behaviour first appears in 1.10.1.
In my example Next.js app, starting from the valtio@1.10.1, every value of nested proxy object becomes undefined, while the keys copied just fine. In the app I use React Context to simplify access to the store: For each Context.Provider provided with the page data, a new proxy is created. The main page has a collection of objects within that main state object, for which I also create a new proxy using Context.Provider. For each created nested object state, I see the keys of that object as expected, but then all the values are gone and replaced with undefined.
Steps to reproduce
First, to run the app you'll need docker compose (not docker-compose).
Clone repository with the only necessary branch, then navigate to the app directory: git clone -b valtio-issue --single-branch git@github.com:octet-stream/next-mikro-orm-trpc-template.git valtio-issue && cd valtio-issue
If you're macOS user, just run npm run demo --build command. It will pull MySQL image used by the app, then build the app itself and start it. After you've done with the demo, press Ctrl+C to stop the app and MySQL.
3.1. On Linux/Windows you might need to setup the app manually: install dependencies npm install
3.2 Run npm run test:compose-up to pull mysql image and run it
3.3 Run npm run build && npm run start to build and start the app (or run npm run dev to start the app in development mode).
3.4 Once you finished with the demo, run npm run test:compose-down to stop MySQL
Once the app is up and running, open http://localhost:3000, then create a new note. After the note is created, you will see that no data is presented within cards. Then if you refresh the page, the result will be the same: You'll see empty note card(s).
Screenshot with the result
Also, if you open browser DevTools console, you can see that notes object has values, as expected. Even for nested objects within notes.items collection. But then in store created for each individual object from this collection the values are undefined.
Check List
Please do not ask questions in issues.
[ ] I've already opened a discussion before opening this issue, or already discussed in other media.
Summary
Tested valtio versions:
1.9.0
,1.10.0
,1.10.1
,1.10.2
. This behaviour first appears in1.10.1
.In my example Next.js app, starting from the
valtio@1.10.1
, every value of nested proxy object becomesundefined
, while the keys copied just fine. In the app I use React Context to simplify access to the store: For eachContext.Provider
provided with the page data, a newproxy
is created. The main page has a collection of objects within that main state object, for which I also create a newproxy
usingContext.Provider
. For each created nested object state, I see the keys of that object as expected, but then all the values are gone and replaced withundefined
.Steps to reproduce
docker compose
(notdocker-compose
).git clone -b valtio-issue --single-branch git@github.com:octet-stream/next-mikro-orm-trpc-template.git valtio-issue && cd valtio-issue
npm run demo --build
command. It will pull MySQL image used by the app, then build the app itself and start it. After you've done with the demo, pressCtrl+C
to stop the app and MySQL. 3.1. On Linux/Windows you might need to setup the app manually: install dependenciesnpm install
3.2 Runnpm run test:compose-up
to pull mysql image and run it 3.3 Runnpm run build && npm run start
to build and start the app (or runnpm run dev
to start the app in development mode). 3.4 Once you finished with the demo, runnpm run test:compose-down
to stop MySQLhttp://localhost:3000
, then create a new note. After the note is created, you will see that no data is presented within cards. Then if you refresh the page, the result will be the same: You'll see empty note card(s).Screenshot with the result
Also, if you open browser DevTools console, you can see that
notes
object has values, as expected. Even for nested objects withinnotes.items
collection. But then in store created for each individual object from this collection the values areundefined
.Check List
Please do not ask questions in issues.
Please include a minimal reproduction.