Edits in files don't get reflected in preview

In bolt.diy I ask the following question:

“app to show hello world”

The file main.js is created with the contents:

console.log('Hello, World!');

In the code editor I change World to Moon, save the file, but the changes are not reflected in the preview.

When I refresh the page, all code files are regenerated from the chat, and existing (modified) files are overwritten.

What is the reason to be able to edit a file when it will be overwritten?

This is a known Bug / Missing Feature. At the moment changes are not persisted in chat and so they are not “reload save”.

Dont know if there is an bug ticket, but @thecodacus we already talked about it in another topic. If there is a ticket, you could link it here pls :slight_smile:

Edit: I forgot, I opened this ticket already => Manual Changes not saved / used when creating code by the AI · Issue #752 · stackblitz-labs/bolt.diy · GitHub

:see_no_evil:

But is it something that is solvable within the current approach of bolt.diy? It looks like bolt.diy needs to be in full control of the code… And when moving in the direction of changing files by the user, we should also be able to add files, remove files, refactor code, etc etc. Before you know it you are rebuilding Visual Studio Code, or extend Visual Studio Code. But then you move onto the path of tools like Cursor, Windsurf and Cline… Maybe better to focus on the “write no code yourself” feature of bolt.diy, make it a code viewer, and make it clear that when a next step is needed, code should be copied out, but can’t be copied in again. Just some thoughts…

2 Likes

Hm I am not sure about this. In a perfect world if the AI would be able to fix everything itself, I would agree.
But at the moment you sometime have to just adjust one line in the code yourself to fix something and go on, what the AI cant fix. I´ve got this many times and tried many prompts to tell it to fix it, but it doesnt.
The workaround then, if no prompt working, even with the correct solution, is to sync the files out, start a new chat and import the code with the fixed stuff again.

There is also this topic: Sync files to/from Bolt with `npx boltops guide` CLI

Did not try it yet, but this could maybe also work.

I see bolt as foundation to go any direction you want.
You are correct that editing files by hand does not really work at the moment.

Currently chat is single source of truth and that is where files are loaded from.
There is something like snapshots discussed so that files are stored and loaded and sent o AI in addition to chat and chat does not really “stores” files.

Or may be stores for history reasons but they are not send to AI.

There is also potential future of better git integration where files are actually in git. So your changes and saving shoult push to git.

Otherwise I agree that I would focus on AI parts yet as that is where differentiation is, making VS code alternative is not purpose of bolt in that sense.

Making VSCode alternative would not make sense, as there are already too many competitors in that space. Might be best to make the code view read-only for now? Bolt.diy its differentiating factor is in my opinion the direct visual feedback you get in the preview, but as @leex279 said, sometimes you just need to change some things and prompting AI to do that exact thing is often very difficult.

1 Like

Yeah I agree, editing by hand seems like a fallback.
And most people will not do it.

I think for no we just should fix that part so that its stored/restored if user edited and saved.

But there are more important things to work on around context management and diff editing.
I think it will make sense to fix it after context management is in place.

2 Likes

Bolt.new online will fix the errors itself but same errors in bolt.diy are not fixing themselves.

hi @TechNomad,
this feature is currently in beta and already available on the main branch. If everything works fine, it will come to the stable.
Feel free to test out in the main branch (which is the development state)