New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fullstack frameworks (SSR) #10575
Conversation
Launch the local version of documentation by running: npm run docs:review 4bb91ab226c10def7425572cdd73ab998640915f |
This definitely requires a mention in the guides. |
@evanSe
There's an option of not including the warning at all and only specifying the requirement in the documentation, but as @budnix noticed, that would end up with a more cryptic React warning being thrown in the SSR cases, which is not a great look either. Which approach do you suggest we go with? |
could we update our react wrapper perhaps to either have a default id always or perhaps https://react.dev/reference/react/useId which from my understanding generates the same id server and client |
We can't use |
Perhaps we should upgrade to react 18 as 16 is very old now. |
@evanSe we need to ask Chris about support for older versions of React. That's a business requirement. We had this conversation here https://handsoncode.atlassian.net/wiki/spaces/SM/pages/5776260/Framework+Support in June, and the rule was 'support what is supported by the author' for all of the frameworks. |
Before we merge this to develop we should do a QA run on it |
@jansiegel @evanSe I bumped the React wrapper to use React v18. The code utilizes the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work with react@16
as well 👍
Context
The PR, along with #10546, allows import and use of the Handsontable (as a client library) with an SSR/Fullstack framework like NextJS, Remix, Nuxt, and more.
Additionally, the PR bumps the wrapper dependency to React 18 (to utilize the
useId
hook). In this shape, it's still compatible with React 16, but in the near future, that support may be dropped.The example using
'next/dynamic'
module (NextJS)Demo https://stackblitz.com/edit/stackblitz-starters-rcgb6z
or using static imports (NextJS)
Demo https://stackblitz.com/edit/stackblitz-starters-r9277n.
The date cell type does not support the second approach as the editor depends on the client-side library Pikaday. For the SSR, the component is rendered twice, so it's advisable to set a uniqueFixed by forking and fixing the Pikaday library handsontable/pikaday#1.id
of the component that will be the same as on the server as on the client.Remix (2.3) example
Gatsby (5.12) example
Nuxt (3.8) example
Live examples:
How has this been tested?
I tested the changes, and I was able to build and serve the app in the following cases:
Fullstack frameworks:
'use client'
);ClientOnly
of theremix-utils/client-only
package);Bundlers:
Types of changes
Related issue(s):
Affected project(s):
handsontable
@handsontable/react
Checklist: