@wordpress/widget-dashboard
Version:
Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.
18 lines (17 loc) • 689 B
JavaScript
import { useObservableValue } from "@wordpress/compose";
import { useDashboardInternalContext } from "../context/dashboard-context.mjs";
// packages/widget-dashboard/src/hooks/use-runtime-actions.ts
const NO_RUNTIME_ACTIONS = [];
/**
* The runtime actions of one instance: what its first mounted render
* declares, so a copy of the tile never takes them over.
*
* @param {string} uuid The instance.
*/
function useRuntimeActions(uuid) {
const { runtimeActions } = useDashboardInternalContext();
const [first] = useObservableValue(runtimeActions, uuid)?.values() ?? [];
return first ?? NO_RUNTIME_ACTIONS;
}
export { useRuntimeActions };
//# sourceMappingURL=use-runtime-actions.mjs.map