mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
chore: bump version to 0.18.0-rc.10 in package.json and update EntityMediaFormField logic for single item handling
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
"bin": "./dist/cli/index.js",
|
||||
"version": "0.18.0-rc.9",
|
||||
"version": "0.18.0-rc.10",
|
||||
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
||||
"homepage": "https://bknd.io",
|
||||
"repository": {
|
||||
|
||||
@@ -242,6 +242,8 @@ function EntityMediaFormField({
|
||||
if (!entityId) return;
|
||||
const maxLimit = 50;
|
||||
const maxItems = field.getMaxItems();
|
||||
const isSingle = maxItems === 1;
|
||||
const limit = isSingle ? 1 : maxItems && maxItems > maxLimit ? maxLimit : maxItems;
|
||||
|
||||
const value = useStore(formApi.store, (state) => {
|
||||
const val = state.values[field.name];
|
||||
@@ -264,7 +266,7 @@ function EntityMediaFormField({
|
||||
key={key}
|
||||
maxItems={maxItems}
|
||||
allowedMimeTypes={field.getAllowedMimeTypes()}
|
||||
/* initialItems={value} @todo: test if better be omitted, so it fetches */
|
||||
initialItems={isSingle ? value : undefined}
|
||||
onClick={onClick}
|
||||
entity={{
|
||||
name: entity.name,
|
||||
@@ -273,7 +275,7 @@ function EntityMediaFormField({
|
||||
}}
|
||||
query={{
|
||||
sort: "-id",
|
||||
limit: maxItems && maxItems > maxLimit ? maxLimit : maxItems,
|
||||
limit,
|
||||
}}
|
||||
/>
|
||||
</Formy.Group>
|
||||
|
||||
Reference in New Issue
Block a user