правка добавления строки в 4 форме
This commit is contained in:
parent
5498bf4935
commit
ea6a6471e4
@ -238,9 +238,13 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
|
||||
});
|
||||
});
|
||||
|
||||
const unsubscribeProgramAdds = subscribeToProgramAdds((data) => {
|
||||
const newRow = data.result[1][0];
|
||||
const unsubscribeProgramAdds = subscribeToProgramAdds((msg) => {
|
||||
let newRow = msg.result[1][0];
|
||||
setData((prevData) => {
|
||||
const hasRoot = prevData.length > 0 && prevData[0].row_type === "ROOT";
|
||||
if (hasRoot) {
|
||||
newRow = msg.result[1][1];
|
||||
}
|
||||
const updateData = structuredClone(prevData);
|
||||
const [row_type, depth, sort_order, dataRow] = newRow;
|
||||
const newRowObject = {
|
||||
@ -250,8 +254,11 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
|
||||
subRows: [],
|
||||
data: dataRow,
|
||||
};
|
||||
const newData = [...updateData, newRowObject];
|
||||
return newData;
|
||||
if (hasRoot) {
|
||||
updateData[0].subRows.push(newRowObject);
|
||||
return updateData;
|
||||
}
|
||||
return [...updateData, newRowObject];
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user