cozy / coachCO2

CoachCO2 aims to raise user awareness about their carbon footprint, notably based on their transport data.
GNU Affero General Public License v3.0
7 stars 1 forks source link

chore: Fix duplication of `createRoot` when reloading #416

Closed Merkur39 closed 6 months ago

Merkur39 commented 6 months ago

For a long time we have had problems with the app's routes opening modals. Indeed, in dev we could not refresh the app with an open modal without it being duplicated.

It is the fact of having the createRoot function in the init function of the app that causes these problems, because the latter executes twice when the app is launched via the yarn start/watch commands.

Other Cozy apps (in the same versions of React) execute this function in setupApp which is memoized, and thus avoids the double execution of createRoot.

### 🔧 Tech

* Fix duplication of `createRoot` when reloading
JF-Cozy commented 6 months ago

est-ce qu'il faut corriger create-cozy-app ?

Merkur39 commented 6 months ago

est-ce qu'il faut corriger create-cozy-app ?

Non, en tout cas aujourd'hui je ne pense pas

bundlemon[bot] commented 6 months ago

BundleMon

Files updated (1) Status | Path | Size | Limits :------------: | ------------ | :------------: | :------------: :white_check_mark: | app/coachco2.(hash).js
| 68.77KB (+11B +0.02%) | -
Unchanged files (3) Status | Path | Size | Limits :------------: | ------------ | :------------: | :------------: :white_check_mark: | vendors/coachco2.(hash).js
| 1.72MB | - :white_check_mark: | vendors-coachco2.(hash).(hash).min.css
| 38.65KB | - :white_check_mark: | app-coachco2.(hash).min.css
| 356B | -

Total files change +11B 0%

Final result: :white_check_mark:

View report in BundleMon website ➡️


Current branch size history | Target branch size history