[Bug]: Storybook cache is unstable and should be thoroughly analyzed to account for file system errors.
#30665 opened on Feb 25, 2025
Description
Describe the bug
We've had this problem for a very long time. I suspect because McAfee Solidifier (unfortunately) is running on our work PCs and aggressively checks files as they are created (preventing write locks). Basically filesystem writes in the cache folder can randomly fail with "OPEN" errors. And by randomly, I mean about every 1-5 times I save a file in our project.
We previously got around this in Storybook 6 by disabling caching through webpack configuration. But there is no way in Storybook 8 to disable the core/src/common/utils/file-cache.ts, which is causing the storybook server to constantly and frequently crash.
I have looked through the codebase, and honesly I am very disappointed at how little thought has gone into filesystem access. You should be treating your filesystem reads and writes like they can fail 20% of the time, and properly handle these error scenarios. Even if 20% is unrealistic, the purpose is to harden your program so you're not running into random filesystem bugs. Especially for something like caching which is not mission critical for the software to run.
Here are some examples I found of unchecked filesystem writes. The errors aren't caught and handled, and usually any sort of write error causes a crash.
You call this project the industry standard, please write your code so that it lives up to this title.
Reproduction link
Reproduction steps
- Run a basic Vue / Typscript / Webpack 5 storybook app.
- Save a couple of times.
- Storybook crashes.
System
Additional context
No response