Skip to content

Double Render in prod. #1

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

Open
MauricioRojasCareers opened this issue Nov 17, 2024 · 3 comments
Open

Double Render in prod. #1

MauricioRojasCareers opened this issue Nov 17, 2024 · 3 comments

Comments

@MauricioRojasCareers
Copy link

Hey, thank you so much for making this repo public! This is pure gold. Just wanted to inform you about something I discovered while trying to extend on the logic you already provided. In your article you note:
"Another thing I missed was a dev environment double-render example. With NextJs 13.4+, React strcit mode is enabled by default on the dev environment. So if you have an initializing function that adds things like Primitives for example, you need to have a cleanup function so the same things don’t get added twice. I added an example in the repo on May 19 2024 tackling this. Or you can turn off React Strict mode… but I do not suggest you doing that!"

I think that your css styles are actually hiding the fact that there is two viewers initialized. That is why when you zoom in to the red ellipse given by the positions, the rendering starts to break down... take a look:
https://drive.google.com/file/d/1j9C1kiGAayKuzIhEz2QUg1ub8imGv-gB/view?usp=sharing

In the first part of the video, I am visiting your deployed version of the app. In the second example where the ellipse does not break down, I have disabled strict mode because when removing the default styling that your repo offers and installing tailwindcss I discovered that the viewer gets rendered twice. I am trying to combat this by fetching terrain data in a server component and passing as props but no luck yet. Doesn't seem to happen in prod though, but I suspect that your deployed app has two viewers overlayed on top of each other.

For reference here is a deployed version of my app (turned strict mode back on for deployment): https://flight-planner-next-git-se-d8bdb6-mauriciorojascareers-projects.vercel.app/

@hyundotio
Copy link
Owner

hyundotio commented Nov 17, 2024 via email

@MauricioRojasCareers
Copy link
Author

MauricioRojasCareers commented Nov 17, 2024 via email

@hyundotio
Copy link
Owner

Thank you! Yea Satcat uses Nextjs, Cesiumjs and some other tech of course.

Regarding your issue, how are you setting terrainProvier to the Cesium Viewer? Are you sure you're not making a new CesiumJs.Viewer every time the data updates or sets? (perhaps, sorry I don't have the full? Make sure you're make a new Viewer once then modify the existing Viewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants