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
@@ -12,11 +12,8 @@ interface PluginSlotProps {
}
export function PluginSlot({ name, className, extraProps }: PluginSlotProps) {
const offers = useSyncExternalStore(
subscribe,
() => offersForSlot(name),
() => [],
);
const getSnapshot = () => offersForSlot(name);
const offers = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
if (offers.length === 0) return null;