Skip to content
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

Documentation: SSR framework behaviour #95

Closed
Jojoker33 opened this issue Oct 13, 2022 · 4 comments
Closed

Documentation: SSR framework behaviour #95

Jojoker33 opened this issue Oct 13, 2022 · 4 comments
Assignees
Labels
bug Something isn't working v1.6.0 Part of the version

Comments

@Jojoker33
Copy link

Is your feature request related to a problem? Please describe.
In SSR framework :

  • elbWalker usage requires dynamic import otherwise it create an error - ReferenceError: document is not defined

Describe the solution you'd like
Update documentations to help with ssr requirement

@alexanderkirtzel
Copy link
Collaborator

alexanderkirtzel commented Oct 14, 2022

Where do you want to use the walker.js? It's made for the browser and requires the window and document environment to set up event listeners etc.

Can you please give some more details?

@Jojoker33
Copy link
Author

In SSR framework such as Next, Nuxt or Sveltekit by example, the rendering is done on the server side which doesn't have object such as Document or window until being on the browser. As more and more, front-end development trend to go to a SSR solution for performance UX improvement, some awareness should be shared about the fact it would have some issue in the ssr, exactly because of the window and document requirement.

Please check this simple nextjs example with simple workaround solution:
document isssue example

@deepskydata
Copy link

+1 - same problem in sveltekit atm.

@alexanderkirtzel alexanderkirtzel self-assigned this Dec 8, 2022
@alexanderkirtzel alexanderkirtzel added the bug Something isn't working label Dec 8, 2022
@alexanderkirtzel
Copy link
Collaborator

Walker.js is currently built for frontend usage, and an instance should be created client-side not server-side.
When calling Elbwalker() window- or document-based operations are performed e.g. init triggers or the elbLayer.
However, there was an issue with the global vars used for document and window. Those are fixed.
I'd suggest moving init to the Layout or a Component. With the fix, it should be possible. To fully support server-side usage & destinations I need to better understand requirements. Feel free to reach out. Fix will be released with 1.6, coming soon.

@alexanderkirtzel alexanderkirtzel added this to Beta (Develop branch) in Current Development Dec 8, 2022
@alexanderkirtzel alexanderkirtzel added the v1.6.0 Part of the version label Dec 9, 2022
@alexanderkirtzel alexanderkirtzel moved this from Beta (Develop branch) to Done in Current Development Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.6.0 Part of the version
Projects
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants