obsidian-workspaces-plus icon indicating copy to clipboard operation
obsidian-workspaces-plus copied to clipboard

Workspaces always showing the asterisk * as if it has changes that need to be saved

Open GitMurf opened this issue 4 years ago • 31 comments

It always shows there are changes to be saved primarily due to sizing of panes. It seems that if you resize panes and save it, the next time it reloads it auto changes the sizes of the panes to "auto fit" so then it shows there is changes to be saved. Is this an obsidian "feature" that auto starts with auto sized panes to make them "equal" parts to fit the screen?

GitMurf avatar Sep 10 '21 15:09 GitMurf

Which version are you using? I don't see this behavior since 0.0.5. The modification logic no longer takes dimension into account.

nothingislost avatar Sep 10 '21 15:09 nothingislost

Ok now it actually looks like it is your plugin that is auto sizing the widths of panes? Watch this video and focus on the left side bottom half pane as i resize it. When using native workspaces save and switch back and forth it saves the size as I make the left side bottom half pane smaller. But as soon as I use the plugin it auto resizes that workspace and actually "auto saves" it too as I go back to load with the core workspaces manager and it now shows the pane resized to auto size instead of the shrinked smaller size I moved it to originally.

image

https://user-images.githubusercontent.com/64155612/132877133-b86b451e-3759-4974-a06b-54c994c2db76.mp4

GitMurf avatar Sep 10 '21 15:09 GitMurf

Which version are you using? I don't see this behavior since 0.0.5. The modification logic no longer takes dimension into account.

I am using 0.0.6 ... but see above screenshot/video. I think that is part of the problem. For whatever reason your plugin is auto resizing panes?

GitMurf avatar Sep 10 '21 15:09 GitMurf

Thanks for the heads up. This was a javascript newb error. I was shallow cloning the workspace object when I thought I was deep cloning. This led to my dimension property removal mutating the actual workspace rather than my comparison clone.

I stealth patched 0.0.6 with a quick and dirty fix if you want to redownload 0.0.6 and try again

nothingislost avatar Sep 10 '21 15:09 nothingislost

haha, I only laugh because I just ran into a problem with my own plugin the other day doing basically the same type of error ;-)

GitMurf avatar Sep 10 '21 15:09 GitMurf

it's a classic :) almost as good as off by 1 issues. thanks for catching it. i haven't been testing workspace sizing changes. my regression test suite is getting rather large :)

nothingislost avatar Sep 10 '21 15:09 nothingislost

Ok the updated version appears to work! Thanks!

BUT now another thing on the asterisk * save indicator "issue". Oddly enough when I load a workspace it starts with the asterisk as if there is a change to save. But then if I drag a pane to a new size the asterisk goes away! Its almost as if it is doing the opposite where asterisk shows it is good to go and saved to current state and non asterisk means it has changed and needs to be saved. Thoughts?

https://user-images.githubusercontent.com/64155612/132882285-d80d874b-9b78-4914-b991-9fd3f401c297.mp4

GitMurf avatar Sep 10 '21 15:09 GitMurf

Is your right sidebar toggling on and off on workspace change? It kind of looks like it from that video and sidebar collapsed state is a modification factor. I could exclude that as well I suppose.

nothingislost avatar Sep 10 '21 16:09 nothingislost

But then why would simply dragging a pane all the sudden make the asterisk disappear as if suddenly it hasn't changed? First off I would expect if you drag/resize a pane that it would actually create a difference to the original workspace and want to show you an asterisk as if there is a change, right?

GitMurf avatar Sep 10 '21 16:09 GitMurf

But also interesting on my right sidebar... I never noticed that. I wonder if a plugin is adding something (a view) to the right sidebar and opening it but then closing it right away or something? But either way that shouldn't explain why when re-sizing a pane it then all the sudden makes the asterisk disappear, right?

GitMurf avatar Sep 10 '21 16:09 GitMurf

I only check for workspace changes on resize and layout-change. Your initial load of the workspace appears to have the right sidebar expanded initially. The modification check kicks off while the sidebar is expanded which is not the sidebar state in your saved workspace.

Then when you resize a pane, it triggers another check and since pane dimension is ignored and the sidebar is properly collapsed now, there is no modification shown.

If resize is included in the modification check, the workspace will almost always show up as modified as the pane dimension is precise to a value that looks like 123.023512094410941

nothingislost avatar Sep 10 '21 16:09 nothingislost

I just checked it a completely brand new vault with zero plugins enabled and it still does that quick "show the right sidebar open and then closes it". Have you tested it with both the right sidebar open on a workspace save and then with it closed and see if you get similar behavior?

GitMurf avatar Sep 10 '21 16:09 GitMurf

If resize is included in the modification check, the workspace will almost always show up as modified as the pane dimension is precise to a value that looks like 123.023512094410941

Makes sense and I am totally good with not having resize be a factor in the calculation.

But this sidebar thing as I stated in my last message seems to be something "core" because I just created brand new vault with no plugins other than your workspaces one and it is doing the same behavior. I also have no theme set and no custom css. As vanilla as it gets and still does that open and close sidebar real quick. Have you tested saving a workspace with sidebars closed? I wonder if just by default obsidian starts with sidebars open and so any saved workspace with them closed it triggers that close after loading?

GitMurf avatar Sep 10 '21 16:09 GitMurf

If I try enough times I can see the sidebar for a millisecond or two but it's not the norm. Despite that, it doesn't show as modified. Having a hard time replicating this so far.

nothingislost avatar Sep 10 '21 16:09 nothingislost

Ok I just created a literally new vault from scratch, only activated the core workspaces plugin and your plugin, did nothing else... not even opening a file and it still does that right sidebar open and close. Also notice it does it here but actually starts with the workspace without the asterisk as expected.

https://user-images.githubusercontent.com/64155612/132886521-01261c37-a7cb-44b5-9822-334bd5a6304f.mp4

GitMurf avatar Sep 10 '21 16:09 GitMurf

Yeah, it's hard to say what's causing the modification trigger. I'd probably need a dump of the layout object json and do a diff to see which properties are drifting. For a simple fix, I can try delaying the check a bit to wait for things to settle.

nothingislost avatar Sep 10 '21 16:09 nothingislost

Ahhh I think we are getting somewhere. Are you testing with backlinks view in the sidebar? When I simply click backlinks view it changes the state and says you need to save. As in the backlinks view in the right sidebar "loads" new elements based on whatever file is active and those new elements (results) maybe are showing as the workspace changed?

GitMurf avatar Sep 10 '21 16:09 GitMurf

Yeah, it's hard to say what's causing the modification trigger. I'd probably need a dump of the layout object json and do a diff to see which properties are drifting. For a simple fix, I can try delaying the check a bit to wait for things to settle.

I was actually going to suggest that... if your check can occur a second or two after reload at least we could try and narrow the potential cause further. If that solves it we know there is something going on during the workspace load.

GitMurf avatar Sep 10 '21 16:09 GitMurf

Yeah I can't for the life of me figure it out. I have tried everything. disabling all plugins one at a time, removing stuff from the sidebars to start more "lean" etc. etc. I even turned off search and file explorer etc. We can see if the "delay" of checking fixed it but otherwise I am going to give up and we'll have to see if you get other reports of the same issues down the road. It isn't that big of a deal to be honest ;) I just am OCD!

GitMurf avatar Sep 10 '21 16:09 GitMurf

Try out https://github.com/nothingislost/obsidian-workspace-picker/releases/tag/0.0.7

nothingislost avatar Sep 10 '21 17:09 nothingislost

Nope, still same issue. And when I drag / resize one of my panes then the asterisk goes away.

But I did see you added a cursor on hover in the status bar which is perfect!

GitMurf avatar Sep 10 '21 17:09 GitMurf

Ok so another thing I have noticed is if I switch workspaces and then immediately (without clicking into any other panes) open the workspace picker plugin from status bar and then click back out of it back into the original pane that was active when the workspace loaded, then the asterisk disappears. I tried to record a video showing you when it does and doesn't work.

It seems the key is I cannot click into any other pane other than the active one as loaded on workspace load otherwise when opening the workspace picker and clicking out it will not remove the asterisk. really weird!!

https://user-images.githubusercontent.com/64155612/132894376-2d516dc9-a00e-48ff-9491-232d2ed5db97.mp4

GitMurf avatar Sep 10 '21 17:09 GitMurf

I'm going to close this for now as there's more interesting things to focus on. I'll make the change status indicator an option so it can be turned off if not working properly.

nothingislost avatar Sep 11 '21 02:09 nothingislost

ok, maybe I sorted this out. are you using the pane relief plugin? I just installed that plugin and noticed it stores quite a bit of data in the workspaces object. when excluding the pane relief properties, the modified status was cleared.

nothingislost avatar Sep 12 '21 14:09 nothingislost

Yep I am. Although I tested it originally but I think that was before you made some of the other tweaks. So that very well could have been the culprit. Do you need me to do anything to test?

GitMurf avatar Sep 12 '21 15:09 GitMurf

https://github.com/nothingislost/obsidian-workspaces-plus/releases/tag/0.1.1 you can test this if you're curious to see if that fixed the issue

nothingislost avatar Sep 12 '21 16:09 nothingislost

still having weird behavior. Not really sure what to do. I have just turned off the setting for showing the asterisk. Maybe move this to a "waiting" or "archived" type status so people still can find it if they have the same issue but then wait and see if you get other reports of it because maybe it is just something weird on my end. I just don't know what / how else to test this and it isn't that big of a deal not being able to see if the current workspace has been changed or not.

GitMurf avatar Sep 13 '21 18:09 GitMurf

Sounds good. Do you mind providing a list of your plugins so I can try and replicate? No worries if not.

nothingislost avatar Sep 13 '21 19:09 nothingislost

Yep I will post them tonight after kids go to bed.

GitMurf avatar Sep 14 '21 00:09 GitMurf

Here are my currently Active/Enabled plugins:

  • Advanced Obsidian URI
  • Buttons
  • Code block from selection
  • Dataview
  • Editor Syntax Highlight
  • Maximise Active Pane
  • MetaEdit
  • Natural Language Dates
  • Note Refactor
  • Obsidian 42 Jump to Date
  • Outliner
  • Ozan's Image in Editor
  • Pane Relief
  • QuickAdd
  • Recent Files
  • Style Settings
  • Templater

GitMurf avatar Sep 14 '21 06:09 GitMurf