Edits visible in IDE not actually saved to project

What I’m trying to do:
Get Anvil’s IDE to recognize my latest edits when running in IDE.

Edit: How you can recognize the problem:
You’re editing a module, and making visible changes, but the Commit button fails to enable.

If the Commit button was already enabled, the only way I’ve spotted the problem is an obvious inconsistency between the Running App and the code, e.g., I changed the text of a label, or the code that generates such text, but the App runs as if I had not yet made the change.

This can also be reflected in the debugger and breakpoints, which act on the old version of the code. New local variables don’t appear, old ones do, and new breakpoints get attached to the corresponding line number in the previous version of the code, so it doesn’t stop at the intended point.

What I’ve tried and what’s not working:
Most of the time, it works normally. But several times a day, now, while my edits appear in the IDE, and I can edit them normally, the Run button doesn’t recognize them, nor does Version Control. If I refresh the IDE, those edits disappear, reverting to the code as the Run button sees it.

Workaround (Python code only): copy the edited module out of the IDE to my favorite editor, refresh the IDE, and paste them back in. This does not work for changes to Forms (.yaml files), however.

My project is too large (and proprietary) to clone, but I will be happy to send a link to Anvil so they can investigate what’s going on inside the IDE, under the covers.

More Context
I’m using Chrome, but this has also happened using Edge (which is also Chromium-based). I don’t think Firefox will work with something of this size.

Edit: I’ve been copying custom components, within a Package, and renaming them. The renames do not carry over into the module source code, not all of them, perhaps due to the length or syntax of the component name.

are you seeing any error logs if you open the console in your browser’s developer tools?

If you let us know the app id, and steps we can take to reproduce, we’ll go take a deeper look

(moved to bug reports)

Thank you, @stucork. I’ve forwarded the App ID privately.

Right now, the console is full of subsequent activity. The next time I see this kind of mix-up, I’ll open the console immediately. I’ll close and reopen the browser so that it will have less junk in it :crossed_fingers: when that happens.

Edit: Loading the App in the IDE produced 4 warnings, and 0 errors, numbers that seem reasonable to me.

I think I just got a clue.

I’m just trying to clean up the structure of an old (but actively updating) App. This App pre-dates packages, so a great many modules and forms are still at the client_code\ level, even though many of them are used only by a single package.

Logically, a single-use module/package should be located within the package/form that uses it. So, now and then, when I find such a case, I relocate the single-use object.

Via drag-and-drop, I just moved a pop-up Form (package FrameWithdrawalByRetirementAge_PeriodCertain) from client_code\ down into the only Form that actually invokes it (package Frames\Btn_WithdrawalByRetirementAge). After adjusting the import statement appropriately (one dot before the module name), the run-time reports that the moved Form was not found.

I have tried putting zero, 1, 2, 3, 4, 5, 6, and 7 “.” characters in front of the module name, but import doesn’t find it. 7 would go past client_code\, and would normally result in a different error entirely.

That is a clue that my edits, the ones that add and remove “.” characters, are not being seen by the Run button.

And indeed, doing an IDE Commit, and a local desktop git pull, still shows the OLD import statement, and the old version of the containing Form, package Frames\Btn_WithdrawalByRetirementAge.

So this drag-and-drop appears to be the trigger. And the destination package (the one receiving the “drop”) is the one that no longer receives updates from the IDE editor.

I was doing a lot of this drag-and-drop last week, as I refined some Custom Components I was working on. No wonder I saw this effect so frequently.

I don’t know if this can be reproduced with a smaller App or not. It’s end-of-day for me, so I haven’t tried.

I have closed my IDE so that our friends at Anvil have a stable instance of the App to look at tomorrow morning. Good hunting!

Edit (2026-02-24 10:30am EST)
Workaround is now clear:

  1. Commit all changes before dragging and dropping
  2. Complete all drags and drops, but do NOT edit any (parent?) package source to match, just yet.
  3. Close the IDE. Drags and drops are saved.
  4. Reopen the App in the IDE
  5. Now you can edit the parent package, e.g., adjust import statements, and do other edits as usual. These edits are recognized by the Run button.

This has been working for me for the last half hour.

Edit (2026-02-24T21:39:00Z)
After several hours of editing with NO dragging and dropping, a module I was editing reverted to a previous version – but only as far as the Run button was concerned. Workaround:

  1. Select the misbehaving module.
  2. Preserve the edited code by copying the entire text of module (only the Python code can be copied)
  3. Refresh the App in the IDE. Now only this module is showing. You can see exactly what code Run was using. Breakpoints, if any, may seem to be displaced, if you added or removed lines above them.
  4. Paste the copied code. This edit is recognized by the Run button, and development can continue.