MDL-85007 core: ensure events are dispatched against the same table.
This ensures that we always dispatch the dynamic table updated event against the same table we just updated. Previously it was possible for another table to receive the event, where both tables were effectively the same instance of one another (e.g. custom reports).
This commit is contained in:
Vendored
+2
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -26,6 +26,7 @@ import Pending from 'core/pending';
|
||||
import {addIconToContainer} from 'core/loadingicon';
|
||||
import {fetch as fetchTableData} from 'core_table/local/dynamic/repository';
|
||||
import Notification from 'core/notification';
|
||||
import {replaceNode} from 'core/templates';
|
||||
|
||||
let watching = false;
|
||||
|
||||
@@ -89,12 +90,10 @@ export const refreshTableContent = (tableRoot, resetContent = false) => {
|
||||
resetContent,
|
||||
)
|
||||
.then(data => {
|
||||
const placeholder = document.createElement('div');
|
||||
placeholder.innerHTML = data.html;
|
||||
tableRoot.replaceWith(...placeholder.childNodes);
|
||||
const tableRootReplacement = replaceNode(tableRoot, data.html, '');
|
||||
|
||||
// Update the tableRoot.
|
||||
return getTableFromId(tableRoot.dataset.tableUniqueid);
|
||||
return tableRootReplacement[0];
|
||||
}).then(tableRoot => {
|
||||
tableRoot.dispatchEvent(new CustomEvent(Events.tableContentRefreshed, {
|
||||
bubbles: true,
|
||||
|
||||
Reference in New Issue
Block a user