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

Differ does not perform row reloading if the changes is happening on same row. (macOS) #86

Open
martindufort opened this issue May 31, 2022 · 3 comments

Comments

@martindufort
Copy link

Hey there,

I've started implementing Differ in our app to drive changes to our TableView.
As our app needs to support 10.15+, we cannot use the native DiffableSource implementation.

So using extendingDiff and patch, I realized that the current AppKit extension that applies the patch to the NSTableView is not using the reloadData(forRowIndexes: IndexSet, columnIndexes: IndexSet) when changes are applicable to a single row.

Here's our patch description:

EmailList DiffPatch [D(4), I(4,<Ocean.EmailListSource: 0x600002d323c0>)]

Why is this important?

By using Delete and Insert, if the selected row was 4, then it is automatically deselected.
This behavior, instead of using reloadDate(forRow...) makes for a pretty bad UX in our case.

Any suggestions on how to circumvent that? Thanks

@tonyarnold
Copy link
Owner

Hi Martin 👋 We should really coalesce that delete then insert of the same row into a reload. There's no workaround, but I'd warmly accept a PR 😄

I've not had much time to work on this library lately, so I won't make promises about when I might get to fixing this.

@martindufort
Copy link
Author

Hey Tony,

I was able to quickly patch the Diff+AppKit.swift file to look for our use case and issue a reload.

However that patch is far away from being usable in the real world. I would need to further understand the internal mechanics of a Patch structure to provide a usable PR for you to review.

It's on my task list however, and like you 😃, it will take sometime to surface.
Let's keep this issue open until I come up with something.

Sounds good?

@tonyarnold
Copy link
Owner

Of course! I'd be happy for any contribution/help, whenever it can be given. Thanks for thinking about the problem.

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

No branches or pull requests

2 participants