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.
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
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
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
It would be helpful if the FAQ were slightly more explicit about what to expect when you create a
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