reactjs/react-tutorial

Remove comments.json from source control

Closed this issue · 2 comments

When playing with a local version of the demo, new comments modify comments.json, which are detected by git, and dirties the current index.

Could we add comments.json to the .gitignore, check if it exists when the app starts, and if not, create it with the existing content below?

[
    {
        "author": "Pete Hunt",
        "text": "Hey there!"
    }
]
zpao commented

I agree that it's a bit annoying. Back when we first did this repo, the original file was left untouched and then current state was left in memory. But we suggest in the tutorial that you can edit the JSON and see the changes in the browser so we made it read from disk on every request. Not ideal but it's a silly tutorial so it's not a huge deal.

What you suggest would be ok as well, except we'd need to do it in every server language. If somebody would like to take that on, I'd review it. Right now we have Node, PHP, Python, Ruby, Go, Lua (ls server.*)

The alternative is that we stop saying in the tutorial content that editing the JSON file is possible. That might be more reasonable (and reduce the dependency on complexity at the server level)

zpao commented

I'm just going to say we're not going to do anything about this anytime soon if ever, so closing out.