Closed
Description
What was done on the platform ?
I did the following changes
- TaskList is now a list of both tasks and tours
- TaskList items are normalized as IDs not as whole objects, i.e. items = ['/api/tasks/1'] not items = [{'@id': 1....}]. I think it will improve performances (as you dont fetch task info (packages, organization, assignedTo, incidents...)
- also as a side note I now use the tasklist:updated event in the dashboard so it removes a (circular) dependencies when you will listen to the 'task:assigned' event to update the tasklist objects (which was causing headach and complex code)
What is the problem with the app?
- doesn't know about the concept of tours
- expects /api/me/tasks to be a list of tasks objects at items key, not IDs
- it expects the task_list:updated to have tasks objects as items, not tasks IDs
- it expects to load /api/task_lists to return task_list with items that are a list of task objects
Remarks
- I think that sending the items as IDs makes more sense, otherwise you duplicate the state in dispatch and you have a lot of synchronization tasks to make. (tasks objects will be present under entites.tasks and entities.tasks_lists.items)
- the fact that app doesnt know about tours is mitigable, but at some point if a web dispatcher creates tours, an app dispatcher will break stuff, as he will see only tasks in his dispatch
Mitigation/workarounds
- the main pain point is on the TaskList endpoint and task_list:updated event
- I don't think their are proper workarounds, as these changes are breaking compability between the two
so I created the following :
- TaskList v2 event : v2:task_list:updated that will return a tasklist with ids (both tours and tasks as items)
- /api/task_list/v2 endpoint that will return a tasklist with ids (both tours and tasks as items)
TODO:
- Migrate to
/api/task_list/v2
endpoint as well as start using/api/tours
and/api/tasks
endpoints (❗️handle pagination) - Migrate to
v2:task_list:updated
event
Cleanup
remove the legacy non-v2 endpoints and events