fix: use plugin slot offer snapshots for useSyncExternalStore

This commit is contained in:
Linus Rath
2026-05-18 11:00:05 +02:00
parent 9f312aa556
commit e16f572252
3 changed files with 38 additions and 17 deletions
+2 -5
View File
@@ -9,9 +9,6 @@ import type { SlotName } from '@/lib/plugin-types';
import { offersForSlot, subscribe } from '@/lib/plugin-sandbox/registry';
export function usePluginSlotOffers(slotName: SlotName) {
return useSyncExternalStore(
subscribe,
() => offersForSlot(slotName),
() => [],
);
const getSnapshot = () => offersForSlot(slotName);
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
}