Skip to content

Commit

Permalink
chore(DashKit): add updated reloadItems method
Browse files Browse the repository at this point in the history
  • Loading branch information
artemipanchuk committed Dec 16, 2024
1 parent cc7c499 commit fa59c02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/DashKit/DashKit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,8 @@ export class DashKit extends React.PureComponent<DashKitInnerProps> {
getItemsMeta() {
return this.metaRef.current?.getItemsMeta();
}

reloadItems(targetIds?: string[]) {
this.metaRef.current?.reloadItems(targetIds);
}
}
9 changes: 7 additions & 2 deletions src/components/GridLayout/GridLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,20 @@ export default class GridLayout extends React.PureComponent {
});
}

reloadItems() {
reloadItems(targetIds) {
const {
editMode,
settings: {autoupdateInterval, silentLoading} = {},
reloadItems,
} = this.context;

const {isPageHidden} = this.state;
const autoupdateIntervalMs = Number(autoupdateInterval) * 1000;
if (autoupdateIntervalMs) {

if (targetIds) {
const targetPluginRefs = this.pluginsRefs.filter((ref) => targetIds.includes(ref.id));
reloadItems(targetPluginRefs, {silentLoading, noVeil: true, targetIds});
} else if (autoupdateIntervalMs) {
const timeSinceLastReload = new Date().getTime() - (this._lastReloadAt || 0);
const reloadIntervalRemains = autoupdateIntervalMs - timeSinceLastReload;

Expand Down

0 comments on commit fa59c02

Please sign in to comment.