I'm trying to understand Flux architecture. I'm using JavaFX and the FluxFX experimental framework.
I'm writing a program which allows user to schedule some task at a specific moment ("in 3 hours", "at 10 o'clock", and so on). The point is that only one task must be scheduled at the same time.
When user hits the "schedule" button, an ScheduleAction is dispatched and the scheduled task is stored in the ScheduleStore. Everything OK. When the user tries to schedule a second task, I would like to ask him/her if he/she wants to cancel the previous task. How can I do that? At this moment, I'm using this approach:
- Dispatch the ScheduleAction.
- The ScheduleStore receives the action and checks if a scheduled task already exists.
- If a task already exists, the store push a message into an EventStream (from ReactFX).
- The view is observing the EventStream, and shows the message in a confirm dialog (using a JavaFX Alert).
- User's response is dispatched in a ResponseAction.
I think this approach "smells bad". What is the correct way to do something like this?
Thank you very much!