Consider giving .data folder special treatment like .env

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 :ghost:

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! :sparkles:

*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

:saxophone::sunglasses::cool:

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 :relaxed:

Thanks!

1 Like

It also doesn’t show because it’s a hidden folder - folders prefaced with ‘.’ aren’t shown in the filetree much like in unix. But I’ll make that FAQ update now.

1 Like

Oh that’s good to know, thanks! I had also tried .foo/bar.json as a comparison test and it did continue to appear in the file tree after a refresh, but maybe something else was at play.

Ooh, glad that my investigation helped with your sleuthing too! :slight_smile:

1 Like