gui: fix chat not reloading on session switch
The C++ connection mapping activeSessionIdChanged to chatModel->reset() raced against the QML onActiveSessionIdChanged handler which does the actual reload (reset → readLogForSession → appendData → trimFront). When the C++ slot fired after the QML handler, it cleared the freshly loaded chat data. Remove the redundant C++ connection — the QML handler owns the full reset+reload sequence and sequences the 9P log read correctly.
This commit is contained in:
parent
9ba1de0c1c
commit
78938cb220
|
|
@ -28,9 +28,11 @@ int main(int argc, char *argv[])
|
||||||
auto *chatModel = new ChatBlockModel(&app);
|
auto *chatModel = new ChatBlockModel(&app);
|
||||||
auto *theme = new ThemeManager(&app);
|
auto *theme = new ThemeManager(&app);
|
||||||
|
|
||||||
// Route chat stream to the block model
|
// Route chat stream to the block model.
|
||||||
|
// Reset + reload is handled in QML's onActiveSessionIdChanged so the
|
||||||
|
// readLogForSession 9P call is sequenced correctly; the C++ slot would
|
||||||
|
// fire before the QML handler and race against the log read.
|
||||||
QObject::connect(ollie, &Ollie9pClient::chatReceived, chatModel, &ChatBlockModel::appendData);
|
QObject::connect(ollie, &Ollie9pClient::chatReceived, chatModel, &ChatBlockModel::appendData);
|
||||||
QObject::connect(ollie, &Ollie9pClient::activeSessionIdChanged, chatModel, &ChatBlockModel::reset);
|
|
||||||
|
|
||||||
engine.rootContext()->setContextProperty("ollie", ollie);
|
engine.rootContext()->setContextProperty("ollie", ollie);
|
||||||
engine.rootContext()->setContextProperty("chatModel", chatModel);
|
engine.rootContext()->setContextProperty("chatModel", chatModel);
|
||||||
|
|
|
||||||
Reference in New Issue