Skip to content

Commit

Permalink
modellist: emit dataChanged on the correct index
Browse files Browse the repository at this point in the history
dataChanged will not work correctly if we emit it on an old index after
sorting.

Signed-off-by: Jared Van Bortel <[email protected]>
  • Loading branch information
cebtenzzre committed Oct 8, 2024
1 parent 4f6d6b3 commit 073bd4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gpt4all-chat/src/modellist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,11 +1000,11 @@ void ModelList::updateData(const QString &id, const QVector<QPair<int, QVariant>
}
}

emit dataChanged(createIndex(index, 0), createIndex(index, 0));

if (shouldSort)
resortModel();

emit dataChanged(createIndex(index, 0), createIndex(index, 0));

// FIXME(jared): for some reason these don't update correctly when the source model changes, so we explicitly invalidate them
m_selectableModels->invalidate();
m_installedModels->invalidate();
Expand Down

0 comments on commit 073bd4d

Please sign in to comment.