Hello, in the test project that I have attached I have encountered some weird behavior.
Store/Filter combo does not seem to work, as a result I've used Item/AppListener in my singleton UserStore.
My singleton UserStore does not receive dispatched actions until an operation is done on the singleton (I'm not sure if this means that it isn't instantiated until this point or if flux is having an issue connecting the signals).
For example, in main.qml I have a no-op line of UserStore; that allows the actions to flow properly, where if it is removed the actions no longer flow.
pragma Singleton
import QtQuick 2.12
import QuickFlux 1.1
import "../actions"
// This does not work
/*Store
{
Filter
{
type: ActionTypes.login
onDispatched:
{
console.log("dispatched");
}
}
}*/
// This does work
Item
{
AppListener
{
filter: ActionTypes.login
onDispatched:
{
console.log("dispatched");
}
}
}
main.qml:
import QtQuick 2.12
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.3
import QuickFlux 1.1
import "actions"
import "stores"
ApplicationWindow
{
id: appWindow
visible: true
width: 640
height: 480
Button
{
anchors.fill: parent
font.pointSize: 20
text: "Login"
onClicked:
{
AppActions.login();
}
}
Component.onCompleted:
{
UserStore; // The action in "Button.onClicked" is no longer received if this no-op line is removed.
}
}
EDIT1: Issue #2 persists even when QuickFlux is removed entirely and replaced with a simple signal/slot mechanism, so it appears to be related to how the singleton object is instantiated in QML.
EDIT2: The profiler confirmed these findings, UserStore is only created when the no-op call is made. Could anyone else confirm this please?
Build kit: Qt 5.13.0 MSVC2017-64 Project: test.zip
Hello, in the test project that I have attached I have encountered some weird behavior.
For example, in main.qml I have a no-op line of
UserStore;
that allows the actions to flow properly, where if it is removed the actions no longer flow.The tree is simple:
UserStore.qml:
main.qml:
EDIT1: Issue
#2
persists even when QuickFlux is removed entirely and replaced with a simple signal/slot mechanism, so it appears to be related to how the singleton object is instantiated in QML.EDIT2: The profiler confirmed these findings,
UserStore
is only created when the no-op call is made. Could anyone else confirm this please?