@civitai/blocks-react 0.61.0 → 0.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -963,16 +963,20 @@ await shared.withdraw(key); // remove my own entry
|
|
|
963
963
|
|
|
964
964
|
Drive the platform Checkpoint picker + persist a viewer override.
|
|
965
965
|
|
|
966
|
-
🔴
|
|
967
|
-
every checkpoint outside the family you pass, so
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
966
|
+
🔴 **OMIT `baseModelGroup` BY DEFAULT.** It is an ecosystem-family FILTER, not a
|
|
967
|
+
label: the host HIDES every checkpoint outside the family you pass, so passing the
|
|
968
|
+
family you are already in is a trap — the picker then offers only the ecosystem the
|
|
969
|
+
user is trying to leave. Omit it for an unconstrained pick and the host applies no
|
|
970
|
+
narrowing at all, offering every checkpoint the viewer can generate with. Pass it
|
|
971
|
+
ONLY when the block must stay inside a family it already holds — a
|
|
972
|
+
regenerate/variation flow, say — and then DERIVE it from that checkpoint, never a
|
|
973
|
+
hardcoded ecosystem string: a literal pins every viewer to whichever family the
|
|
974
|
+
author happened to test with. `''` is **not** an escape hatch — it does not even
|
|
975
|
+
mean the same thing on both hosts. On a **model slot** the host normalises whatever
|
|
976
|
+
string you send, so `''` resolves to the real ecosystem key `Other` and NARROWS to
|
|
977
|
+
that one family. On a **page** the host drops a zero-length value, so `''` behaves
|
|
978
|
+
exactly like omitting it. Neither is what you meant on at least one surface: omit
|
|
979
|
+
the key, or pass a family derived from a real checkpoint, and never `''`.
|
|
976
980
|
|
|
977
981
|
```tsx
|
|
978
982
|
import { isModelSlotContext } from '@civitai/app-sdk/blocks';
|
|
@@ -980,16 +984,30 @@ import { isModelSlotContext } from '@civitai/app-sdk/blocks';
|
|
|
980
984
|
const { context } = useBlockContext();
|
|
981
985
|
const { open, persist } = useCheckpointPicker();
|
|
982
986
|
|
|
983
|
-
//
|
|
987
|
+
// DEFAULT — pass no baseModelGroup. The viewer can reach every family.
|
|
984
988
|
if (isModelSlotContext(context) && context.checkpoint) {
|
|
985
|
-
const { selected } = await open({
|
|
986
|
-
baseModelGroup: context.checkpoint.baseModel,
|
|
987
|
-
currentVersionId: context.checkpoint.versionId,
|
|
988
|
-
});
|
|
989
|
+
const { selected } = await open({ currentVersionId: context.checkpoint.versionId });
|
|
989
990
|
if (selected) await persist(selected.versionId); // null clears the override
|
|
990
991
|
}
|
|
991
992
|
```
|
|
992
993
|
|
|
994
|
+
Pass `baseModelGroup` **only** when the block must stay inside a family it already
|
|
995
|
+
holds — a regenerate or variation flow pinned to one checkpoint's ecosystem — and
|
|
996
|
+
then derive it from that checkpoint, never from a literal:
|
|
997
|
+
|
|
998
|
+
```tsx
|
|
999
|
+
import { isModelSlotContext } from '@civitai/app-sdk/blocks';
|
|
1000
|
+
|
|
1001
|
+
const { context } = useBlockContext();
|
|
1002
|
+
const { open, persist } = useCheckpointPicker();
|
|
1003
|
+
|
|
1004
|
+
// ONLY to stay inside the family the block already holds — derived, never a literal.
|
|
1005
|
+
if (isModelSlotContext(context) && context.checkpoint) {
|
|
1006
|
+
const { selected } = await open({ baseModelGroup: context.checkpoint.baseModel });
|
|
1007
|
+
if (selected) await persist(selected.versionId);
|
|
1008
|
+
}
|
|
1009
|
+
```
|
|
1010
|
+
|
|
993
1011
|
### `useResourcePicker()`
|
|
994
1012
|
|
|
995
1013
|
Drive the platform resource picker for page blocks — `'Checkpoint' | 'LORA'`.
|