Azure / Azure/static-web-apps

"Incrementally" deploy the Azure Static Web app

Open
#448 19 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hello,
we are using the Azure Static Web Apps in combination with React Apps. Like most of the React Applications we are using [code splitting](https://reactjs.org/docs/code-splitting.html#:~:text=Code%2DSplitting%20is%20a%20feature,be%20dynamically%20loaded%20at%20runtime.) to bundle our resources.

The default webpack configuration in Create React App (and best practice) is to hash your assets.
```
main.[hash].chunk.js
1.[hash].chunk.js
2.[hash].chunk.js
```
Each of your JS and CSS files will have a unique hash appended to the filename that is generated, which allows you to use aggressive caching techniques to avoid the browser re-downloading your assets if the file contents haven’t changed.

If I am not mistaken when publishing a new version to the Azure Static Web app old deployed assets are being replaced by the new assets bringing up these new issue.
- If the user tries to navigate to a different route, there is a possibility that the required JS file is no longer available from the Azure Static Web App. So the app will fail receiving the files.
- It gets worse if the index.html file is not being immediately reloaded. The whole app stops working. This is a behavior we noticed with when embedding our solutions in the Microsoft Teams client as a Tab

I would like to ask you what your recommendations and best practices are to tackle this problem? Do you think it might be possible to have an option to "incrementally" upgrade an app during deployment? My thought was to keep a copy of the current version residing on the Azure Web App and "just" override the files that have been changed, keeping the old files and not deleting them from the folder. There shouldn't be a big overhead over time. On the other hand, it will ensure that users are not facing such issues due to caching.

Alternatively, we would also be happy to have the opportunity to directly access the filesystem of the Static Web App and handle these deployment scenarios by our own.

Thank you very much for your feedback,
Patrick

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.