镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix animation (#45) - #61

Closed
0xWDG wants to merge 3 commits into
CodeEditApp:mainfrom
0xWDG:main
Closed

0xWDG wants to merge 3 commits into
CodeEditApp:mainfrom
0xWDG:main

Conversation

@0xWDG

@0xWDG 0xWDG commented Mar 18, 2022

Copy link
Copy Markdown
Collaborator

No description provided.

@lukepistrol lukepistrol linked an issue Mar 18, 2022 that may be closed by this pull request
func sidebarFolderItem(_ item: WorkspaceClient.FileItem) -> some View {
DisclosureGroup(isExpanded: $isExpanded) {
if isExpanded { // Only load when expanded -> Improves performance massively
ForEach(item.children!.sortItems(foldersOnTop: workspace.sortFoldersOnTop)) { child in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually required since in a very large project folder this will load all children all the time which leads to very long file opening times.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen.Recording.2022-03-18.at.15.59.15.mov

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It breaks the animation.

Maybe it's an idea to only place the labels, and then update them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can figure something out that doesn't break performance that'd be awesome. So far this if clause was the best option I found

@0xWDG 0xWDG Mar 18, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So instead of

SideBarItem(item: child,
workspace: workspace,
windowController: windowController)

We should use?

SideBarItem(item: child,
workspace: workspace,
windowController: windowController,
loadSubitems: isExpanded)

Or (maybe the worst solution)

Text(child.name) // Don't know is child.name exists. its pseudo code

@0xWDG 0xWDG Mar 18, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, the issue is, when you open a file, it's rendering the whole file tree again.

This should

  1. be done on the background
  2. or not at all when opening a file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I suspected as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I just tested the latest commit and it seems to run very nice. Couldn't see performance losses to before.

@0xWDG 0xWDG Mar 18, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, after some research, opening/closing doesn't trigger an update.
selecting a file does.

There seems to be a delay again when opening files from that video

This has been fixed with commit 6dfa149

6dfa149 (for refrerence, clickable)

This commit increases the speed, but this is not the solution, the problem is that this bar is getting re-rendered when you open/select a file.
if you disable this if, and only open and close the disclosure groups, then it works as expected.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiftUI acts strangely sometimes…

@lukepistrol
lukepistrol marked this pull request as draft March 18, 2022 15:04
@lukepistrol

Copy link
Copy Markdown
Member

Something you might want to have a look at:
When opening a file in a subfolder, and then collapsing the subfolder, the editor will disappear.

@austincondiff

Copy link
Copy Markdown
Collaborator

There seems to be a delay again when opening files from that video

@lukepistrol

Copy link
Copy Markdown
Member

There seems to be a delay again when opening files from that video

This has been fixed with commit 6dfa149

@0xWDG

0xWDG commented Mar 18, 2022

Copy link
Copy Markdown
Collaborator Author

I'm closing this pull request.
it requires someone with more SwiftUI experience, or need some more time to figure out.
I'm first going to help on other issues.

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

Successfully merging this pull request may close these issues.

3 participants