pmndrs / valtio

💊 Valtio makes proxy-state simple for React and Vanilla
http://valtio.pmnd.rs
MIT License
8.7k stars 244 forks source link

Allow passthrough of Redux devtools options #713

Closed sarimarton closed 1 year ago

sarimarton commented 1 year ago

The current 'devtools()' util in Valtio restricts the Redux-devtools option to the 'name' field, and a custom 'enabled' field. But it might be useful to pass other devtools options too to Redux-devtools. My current case, which motivated this, is that I'm having a large data set in the proxy store (as a ref() of course), and any change to the proxy causes a significant lag in redux-devtools. This has been performance measured in Chrome. The solution is to customize redux-devtools' serializer to skip the large data part, as I don't need to see that part. This way I can further debug other perf-related bottlenecks in my heavy app. During this effort, it seemed like Valtio unnecessarily restricted the redux-devtools options object, so this change only lifts this restriction.

Related Issues or Discussions

Fixes #

Summary

Check List

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
valtio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2023 8:33am
codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3c5cb5489961988906d8dc6c3c5e762ee1fa0e7c:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
React Parcel Configuration
dai-shi commented 1 year ago

While the idea is good, this PR needs more work and it's incomplete. Closing as stale for now. Feel free to add comments.

sarimarton commented 1 year ago

Wouldn't it be better merging it in with a @todo flag? I'm not sure what problems need to be solved. Even with no extra typing, just as an escape hatch...

dai-shi commented 1 year ago

The two things are really something addressed. Especially, the first one is not acceptable as it caused problems previously. The second one is easy to fix without todo flag.

dai-shi commented 1 year ago

I will modify the branch.