LibGUI: Only clear TreeView::m_view_metadata
when required
Prior to this commit, we were always clearing the TreeView's metadata, even if it wasn't needed. Now, we only clear it if the callee says that we should invalidate indices. This fixes an issue in FileManager (#6903), where updating the file system by creating/deleting any file/folder would cause the tree to collapse completely. This may be more of a 'patch' than an actual fix, since I don't have a lot of experience with `GUI::TreeView` or `GUI::Model`, but it doesn't appear to break any other `TreeView` use-cases and using FileManager is now much better than it was before :^)
This commit is contained in:
parent
8d446d2a9e
commit
d05cb50b24
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/caoimhebyrne Commit: https://github.com/SerenityOS/serenity/commit/d05cb50b24 Pull-request: https://github.com/SerenityOS/serenity/pull/18598
1 changed files with 4 additions and 1 deletions
|
@ -414,7 +414,10 @@ void TreeView::scroll_into_view(ModelIndex const& a_index, bool, bool scroll_ver
|
|||
|
||||
void TreeView::model_did_update(unsigned flags)
|
||||
{
|
||||
m_view_metadata.clear();
|
||||
if (flags == Model::UpdateFlag::InvalidateAllIndices) {
|
||||
m_view_metadata.clear();
|
||||
}
|
||||
|
||||
AbstractTableView::model_did_update(flags);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue