Devographics / Monorepo

Monorepo containing the State of JS apps
surveyform-sigma.vercel.app
Other
121 stars 49 forks source link

Feature/form rerender #313

Closed eric-burel closed 9 months ago

eric-burel commented 9 months ago

Test: I am pressing a button of the slider, and check if the radiogroup below "Bonheur général" is also rerendered image

Before (all stuff in color rerender): image

After (all stuff in grey do not rerender => formLayout): image

I could remove some rerenders but cutting the Form context more correctly between values that do not move (context is only used in order to avoid props drilling), values that moves (response state) and actions (updating a value, but not depending on the current global values). I've also used memo on the Radiogroup.

The problem I hit is that FormItem is too generic, and therefore require a lot of data. For instance, it uses the response to check for a dynamic path commentPath => that's no good, because it means you need to whole response to access only response[commentPath], but I can't really get around that yet.

We should try to avoid doing to much in the FormItem and perhaps move this kind logic to a callback passed by the parent, or some global context or whatever.

At least this PR cleans the code a little and opens room for more future optimizations.

Oh yeah and this has no impact on #237 (radiogroup on Firefox), probably because the radio still rerender.

vercel[bot] commented 9 months ago

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

Name Status Preview Updated (UTC)
charts ❌ Failed (Inspect) Sep 26, 2023 4:41pm
netlify[bot] commented 9 months ago

Deploy Preview for devographics-static failed.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/devographics-static/deploys/651309bdceddfe00082d4643
netlify[bot] commented 9 months ago

Deploy Preview for stateofjs canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/stateofjs/deploys/651309bd08c66200084f36ac
netlify[bot] commented 9 months ago

Deploy Preview for state-of-graphql canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/state-of-graphql/deploys/651309bd01cb9f000869db7b
netlify[bot] commented 9 months ago

Deploy Preview for stateofjs2022 canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/stateofjs2022/deploys/651309bdd2e8f40008c5387e
netlify[bot] commented 9 months ago

Deploy Preview for graphiql-devographics canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/graphiql-devographics/deploys/651309bdcb98150008315c64
netlify[bot] commented 9 months ago

Deploy Preview for devographics-graphiql2 canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/devographics-graphiql2/deploys/651309bdaf1af40009014f9f
netlify[bot] commented 9 months ago

Deploy Preview for stateofcss canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/stateofcss/deploys/651309bd1412b40008e7fd8c
netlify[bot] commented 9 months ago

Deploy Preview for css2023 failed.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/css2023/deploys/651309bd2efe880008fdc217
netlify[bot] commented 9 months ago

Deploy Preview for tokyodev2022 canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/tokyodev2022/deploys/651309bdf55b3200085a1ccf
netlify[bot] commented 9 months ago

Deploy Preview for devographics-graphiql-internal canceled.

Name Link
Latest commit 6015fb6caa35806a90dad934a66f93c13e80ed7e
Latest deploy log https://app.netlify.com/sites/devographics-graphiql-internal/deploys/651309bda5665100087a4b39
gatsby-cloud[bot] commented 9 months ago

:x: State of CSS 2022 deploy preview failed

Your build failed. View the build logs.

gatsby-cloud[bot] commented 9 months ago

:x: State of CSS 2022 deploy preview failed

Your build failed. View the build logs.

gatsby-cloud[bot] commented 9 months ago

:x: State of GraphQL 2022 deploy preview failed

Your build failed. View the build logs.

gatsby-cloud[bot] commented 9 months ago

:x: State of GraphQL 2022 deploy preview failed

Your build failed. View the build logs.