The FAQ helpfully suggests using a .data folder to store persistent data files. However, doing so seems to result in unexpected behavior: namely, .data and its children will always vanish from the file tree after a refresh
With enough amateur sleuthing, you’ll eventually find that the FAQ does give us two other bits of information elsewhere to explain why this is happening:
Note that for security reasons, the
.envfile and contents of the.datadirectory aren’t copied when a project is remixed.
and:
If you have a
.gitignorefile, any files specified by its rules are not shown in the editor.
Taken together (and extrapolating a bit): .data and its children are ignored by Git* to prevent them from being remixed, and as a result they aren’t shown in the file tree. Mystery solved!
*I got thrown off the trail when I looked for
/app/.gitignoreand didn’t find one. It wasn’t until I found this question that I discovered.datais ignored globally, regardless of whether a given project has a.gitignorefile.
Desired Behavior
I think my confusion might have been further compounded by the special handling of .env. It’s included in the global Git ignore list, too, but it appears in the file tree as 🗝 .env.
It would be really nice if the contents of .data could be given similar treatment:
📦 assets
🗝 .data/foo.json
🗝 .data/bar.json
🗝 .env
README.md
Alternative Suggestion
It would be helpful if the FAQ were slightly more explicit about what to expect when you create a .data folder:
We recommend creating a folder called
.dataas a safe place to store your data files. This folder isn’t copied when a project is remixed. Note that because this directory is excluded by Git its contents will not appear in the file tree.
Or something similar
Thanks!