Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Fixes /zone/WHATEVZ breaking the app + disables chunking for now #160

Merged
merged 3 commits into from
Jan 20, 2023

Conversation

madsnedergaard
Copy link
Member

Description

This fixes the problem where https://app.electricitymaps.com/zone/hello would crash. We also had to disable the chunks as it broke the build - Radix was trying to use React, but crashed because it didn't have it available (probably because it loaded one before the other?)

@madsnedergaard
Copy link
Member Author

FYI I already released this (as the chunks part was breaking builds)

@VIKTORVAV99
Copy link
Member

If radix is the only problem I suggest we just comment out that (or at least keep chunking the config and map files). It does impact performance significantly if we can download this data in parallell by utilizing full multiplexing.

Also radix should not crash in the first place but that's another issue...

@VIKTORVAV99
Copy link
Member

Tested the chunking locally again and it's not breaking for me, are we sure it's the chunking that's causing this?

Copy link

@tonypls tonypls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, maybe add a comment why it's disabled and that dependant packages should be in the same chunks

@tonypls
Copy link

tonypls commented Jan 19, 2023

Tested the chunking locally again and it's not breaking for me, are we sure it's the chunking that's causing this?

It seemed only to surface when we had built the project

@VIKTORVAV99
Copy link
Member

Tested the chunking locally again and it's not breaking for me, are we sure it's the chunking that's causing this?

It seemed only to surface when we had built the project

Super weird, I ran it with pnpm run build and then pnpm run preview and everything seemed to work. Although it did not pick up the mockserver data but I assumed that was intentional?

@madsnedergaard
Copy link
Member Author

Oh sorry, my comment got lost (I probably forgot to click the green button)... Anyway, this was a very hit-and-miss situation where sometimes it broke and other time not, so I suspect there's a timing issue during the build phase where it might or might not have the React dependency ready/included. Let's try enabling chunking again for config files only at first :)

web/vite.config.ts Outdated Show resolved Hide resolved
web/vite.config.ts Outdated Show resolved Hide resolved
@VIKTORVAV99
Copy link
Member

VIKTORVAV99 commented Jan 19, 2023

Oh sorry, my comment got lost (I probably forgot to click the green button)... Anyway, this was a very hit-and-miss situation where sometimes it broke and other time not, so I suspect there's a timing issue during the build phase where it might or might not have the React dependency ready/included. Let's try enabling chunking again for config files only at first :)

Perhaps we can try using react.lazy() to split some of these instead? Like the flags? They are not used at first load on mobile so it would be a great candidate.

@madsnedergaard madsnedergaard merged commit 90f73d2 into master Jan 20, 2023
@madsnedergaard madsnedergaard deleted the mn/fix-invalid-zoneid-url branch January 20, 2023 09:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants