Error on using $set for the second time, adding new task
labs20 opened this issue · comments
Hi.
I have a button on my form for the user be able to add new tasks. When clicked we go to server and create the new task, then select all project data again (in case someone just have changed something somewere), build up the payload and send it back to client.
This is the same routine for the first load of the gantt, except of course for the "new task" part. My point is that the second payload is exactly the same of the first one, except for the new task.
On the client side I have a post processing function that receive the payload and process it to feed the gantt props. this is because this payload have a default format that feeds other comps as well.
This is how I'm feeding the gantt:
value(new_val, old_val) {
if (new_val.itens) {
try {
let [headers, rows, tasks, dependences, ranges] = this.processValue(new_val);
this.gantt.$set({
tableHeaders: headers,
rows: rows,
tasks: tasks,
dependences: dependences,
timeRanges: ranges,
});
...
The thing is, when I call this for the firs time, at page load, it goes just fine, but when it is called for the second time, after the addTask, then I got this execption:
index.js:3929 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'model')
at get_key_3 (index.js:3929:1)
at update_keyed_each (index.js:411:1)
at Object.p (index.js:4173:1)
at update (index.js:352:1)
at flush (index.js:321:1)
Can you please help? How is the proper way to update the comp with a new payload from server?
Thanks
Ok, this is probably on my side.
Looks like the new_value
at Vue whatch event is not exactly what I expected.
Thanks.