Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sliding Pane Won't Close #109

Open
gwillcox-r7 opened this issue Jul 5, 2022 · 16 comments
Open

Sliding Pane Won't Close #109

gwillcox-r7 opened this issue Jul 5, 2022 · 16 comments

Comments

@gwillcox-r7
Copy link

gwillcox-r7 commented Jul 5, 2022

When opening certain panes a new blank pane will open. If I try to close that pane, now it will continuously open that pane again....and again....and again. Its now impossible to close that second pane down so I'm left with a screen that constantly looks like this:

image

This seems to have only occurred after I updated to the latest plugin version aka 3.3.0 about 2-3 days ago.

@gwillcox-r7
Copy link
Author

Hmm so seem to have narrowed this down a bit. This seems to only occur when one of the items is a pinned item in Obsidian. If you unpin the item to the left, then things work fine and the panel to the right will close. Repinning does not trigger the malignant behavior thankfully.

@mrkuramoto
Copy link

Hi Grant (gwillcox-r7), I'm facing exactly what you described. Is this a bug or expected behavior of the plugin?
I reported "the problem" but haven't received any comment (#106).

Thank you

@visaeryon
Copy link

i am too facing this bug when i updated this plugin today, i reverted back to the release 3.2.3 manually to get rid of this bug.

@transmitthis
Copy link

Same bug here also same details as gwillcox-r above

@gwillcox-r7
Copy link
Author

Hi Grant (gwillcox-r7), I'm facing exactly what you described. Is this a bug or expected behavior of the plugin? I reported "the problem" but haven't received any comment (#106).

Thank you

I believe this is new, it didn't act like this before from what I can tell and @Vichu-dev's comment suggests this is a regression.

@MILKMILKKING
Copy link

我今天更新这个插件时也面临这个错误,我手动恢复到版本 3.2.3 以摆脱这个错误。

Can you please tell me if you can get back to normal after reverting to version 3.2.3?
I still have the problem of not being able to close the page after reverting to version 3.2.3.

@antomonte
Copy link

antomonte commented Jul 29, 2022

Yes, I'm facing the same issue. At the very moment that the plugin is enabled, it creates an empty pane which is impossible to get closed.

Obsidian.-.Sliding.panes.mp4

This happens if all the open panes were pinned. If any open tab gets unpinned, then makes it possible to close such an empty pane. For doing this video testing, ALL other plugins were turned OFF, and Obsidian was also restarted.

I'm using the latest versions, that is:
Obsidian: v0.15.9
Sliding Panes plugin: 3.3.0

This behaviour makes it pretty uncomfortable to deal with the panes. Please correct it if possible.

Thanks!

@torves
Copy link

torves commented Jul 31, 2022

I've come here after experiencing the same issue myself. I've dug into the Sliding Panes source a bit and found the cause of the issue.

This is caused by calling Workspace.getLeaf in the Obsidian API. Internally it will call getUnpinnedLeaf which returns the default start screen if there are no unpinned leaves.

let activeLeaf: WorkspaceItemExt = this.app.workspace.getLeaf() as WorkspaceItem as WorkspaceItemExt;

The active leaf is used when deciding if it should be focused when it is currently in the active container.

// if the active leaf is in the current container, and the width has changed, refocus the active leaf
if(activeLeaf.getContainer() as unknown as WorkspaceParentExt === rootSplit && widthChange) this.focusLeaf(activeLeaf, !this.settings.leafAutoWidth);

I'm not sure why this is done, seems to be related to Obsidian popout windows. I've been using a modified version of the Sliding Panes plugin with those bits of code removed without noticing any issues.

@MILKMILKKING
Copy link

@torves
I don't know anything about code at all, can you please teach me how to delete these codes?

@visaeryon
Copy link

@torves I don't know anything about code at all, can you please teach me how to delete these codes?

I would suggest reverting back to 3.2.3 release manually and see if the bug is fixed, before trying the code deletion method.

@mrkuramoto
Copy link

Hello torves,

Thank you very much for your tip, it worked smoothly. I edit the file "main.js" in sliding-panes-obsidian directory and added "//" in front of "workspace.getleaf"... the code line in my file was not exactly the same as your code but searching by "workspace.getLeaf" was enough to find and neutralize the codes

@mrkuramoto
Copy link

mrkuramoto commented Aug 27, 2022

I would like to share what I did to fix the problem based on the @torves' comments (thank you very much)

I was suspicious of the possibility to lose the content of the "today's daily notes"... now I'm sure that it doesn't happen.

01 - go to the Obsidian plugin folder
02 - find the plugin called "sliding-panes-obsidian" (it is a folder)
03 - inside the folder, find a file called "main.js"
04 - right click and choose "open with"
05 - it is possible to choose "notepad" -> I'm using "Atom" which is free and offer a very nice interface
06 - find this line "if (activeLeaf.getContainer() === rootSplit && widthChange)"
07 - neutralize it adding "//" in front of the line
08 - find this line "_this.focusLeaf(activeLeaf, !_this.settings.leafAutoWidth);"
09 - neutralize it adding "//" in front of the line
10 - DO NOT TOUCH THIS LINE "var rootSplit = activeLeaf.getContainer();"
11 - find this line " // var activeLeaf = _this.app.workspace.getLeaf();"
12 - neutralize it adding "//" in front of the line
13 - that's all, save the file and restart Obsidian

I hope those steps could help someone

@MILKMILKKING
Copy link

I would like to share what I did to fix the problem based on the @torves' comments (thank you very much)

Important - always backup your data! I don't know the reason but I lost the content of my Daily Note when I was doing the steps described below. Nothing to do, but I lost.

01 - go to the Obsidian plugin folder 02 - find the plugin called "sliding-panes-obsidian" (it is a folder) 03 - inside the folder, find a file called "main.js" 04 - right click and choose "open with" 05 - it is possible to choose "notepad" -> I'm using "Atom" which is free and offer a very nice interface 06 - find this line "if (activeLeaf.getContainer() === rootSplit && widthChange)" 07 - neutralize it adding "//" in front of the line 08 - find this line "_this.focusLeaf(activeLeaf, !_this.settings.leafAutoWidth);" 09 - neutralize it adding "//" in front of the line 10 - DO NOT TOUCH THIS LINE "var rootSplit = activeLeaf.getContainer();" 11 - find this line " // var activeLeaf = _this.app.workspace.getLeaf();" 12 - neutralize it adding "//" in front of the line 13 - that's all, save the file and restart Obsidian

I hope those steps could help someone

I tried your method with Notepad and it solved the problem of not being able to close blank windows perfectly and without any file loss! Thank you very much for your help!

@mrkuramoto
Copy link

mrkuramoto commented Aug 27, 2022

Hello @MILKMILKKING, I'm glad to hear that!! 😀😀😀

@mrkuramoto
Copy link

hahaha, Obsidian v0.16.0 has just been released and changed everything.
Obsidian 0.16 introduces a new default theme, a new theme versioning system, and several important new features. We expect that most themes and plugins will need some tweaks.

@gwillcox-r7
Copy link
Author

Well Obisidian 0.16.2 just introduced tab stacks which should essentially offer most of the same functionality as this plugin. I'll leave this issue open but if anyone is looking for an intermediate solution in the meantime this may be something to look into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants