-
Couldn't load subscription status.
- Fork 280
refactor(Device): use internal getters to support SSR #6421
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
Conversation
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.
Looks good to me. Unless anyone else wants to review today, I can +1
|
can we add a test? this will break pretty easily and no one will notice. I was thinking a very simple nodejs import that should pass without an error, like: this can be in a package.json script and called in addition to the current test command. For this to work, I needed to add Additionally, I get an error in your branch with the above test: |
I think until we can use such a test it will take quite some time as the webcomponents themself can't render on the server yet. As this PR is mainly about the changes in the |
|
Fine with me, the device import already works. I was not talking about the rendering of the components, but their imports should not fail on the server. I think you import the components as well, even just to render their tags via the wrappers. Anyway, it's fine to add such an import test to the components with another change, let's do a base test for now. |
|
Just had a call with @pskelin: Current Challenges:
|
The UI5 Web Components for React project is currently looking in how we can support Server Side Rendering with minimal efforts. As we're using some of your base package API's, we need to make sure that they don't throw errors when being used in server side runtimes.
The
Deviceused to execute various functions on client only API when imported which caused errors when used in SSR frameworks like NextJS.With this PR all internal calls are refactored to use SSR-safe getters and all detections return
falseon the server. The behaviour on the client and the public API is unchanged.In addition to that, the
Boot,InitialConfigurationandgetSharedResourceandCustomStyleare now SSR safe as well.Part of #2240