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
.env
file and contents of the.data
directory arenât copied when a project is remixed.
and:
If you have a
.gitignore
file, 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/.gitignore
and didnât find one. It wasnât until I found this question that I discovered.data
is ignored globally, regardless of whether a given project has a.gitignore
file.
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
.data
as 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!