Why App Designer wants to always save changes even if nothing is changed?

19 views (last 30 days)
This is not a serious problem but it is quite annoying:
Every time when I open mlapp file in App Designer it immediately shows the file has changed and wants to save it after closing, although I have not even clicked anything on the editor. And, especially if I have had a longer session with several files open, I cannot remember which ones I have actually changed and then have to save all to be sure.
This causes extra trouble when using version control, because the saved mlapp is always different, even if there is no changes. So, I end up updating mlapp files to version control all the time even there is no need to. I know that if I would convert mlapp to m-file then version control could detect if there is actually any change, but after conversion to m-file it cannot be edited in App Designer anymore, so it is not a practical option.
Does anybody know why this is happening and is there any fix for it?
I wonder if Mathworks staff is aware of this and going to do anything for it.
  9 Comments
Ameer Hamza
Ameer Hamza on 3 Nov 2020
Ok, I didn't notice it earlier. I tried the two apps you shared. The first time I open it, I get the same behavior (i.e., an asterisk appears to save the file). However, once I save the file and close it, then on the subsequent opening of the files, it does not show an asterisk. I got the same behavior on both windows 10 and macOS.
Also, the first time the asterisk appears is not without reason. It appears after showing the message "app name updated to match the file name". This message appears if you initially created your app with one name and then rename the mlapp file. For example, initially, I named my app as myApp.mlapp; the first line in code view is
classdef myApp < matlab.apps.AppBase
but If I rename the file to myApp2.mlapp and then open the file, the MATLAB will automatically change the first line to
classdef myApp2 < matlab.apps.AppBase
and consequently the asterik appears.
Petri M
Petri M on 3 Nov 2020
Ameer Hamza, yes of course app2 has different classdef name because I was simply copying it with different name just for comparison purposes. That was not the problem.
The problem is that if I open app1 and save it, close App Designer, and open app1 again (for example using command line "edit app1", then App Designer shows it has been changed.
For some reason, there is a difference between this small demo app and my big project app:
With app1 the problem occurs only when I close App Designer and open it again. However, with my big project app the problem occurs also without closing App Designer. But anyway, with both apps the problem occurs if I close App Designer and open it again. And do not ask me to post that big project app, it is confidential.

Sign in to comment.

Accepted Answer

Petri M
Petri M on 11 Nov 2020
I am answering myself, because I found out what is causing the bug.
Yes, it is a bug in Matlab. It is happening when using tab size other than default 4 (in preferences). When I create an app using the default tab size of 4, there is no problem. But when I use other than 4 (tried 2 and 6), and create for example just an empty app (create a blank app and save it), then it wants to save it every time after opening the App Desiger (however, you have to close the App Designer in between).
  2 Comments
Mario Malic
Mario Malic on 11 Nov 2020
Nice find!
However, TMW won't notice the bug if it's not submitted to bug reports or if staff sees this question.
Petri M
Petri M on 11 Nov 2020
Thanks Mario! I have made a bug report and it is being processed already.

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!