Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add loader skeleton for rich text field #530

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silver-emus-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@premieroctet/next-admin": patch
---

feat: add loader skeleton for rich text (#462)
2 changes: 1 addition & 1 deletion .github/workflows/check-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
fetch-depth: 0
- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate
- name: Set up Node.js
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate
- uses: actions/setup-node@v3
with:
node-version: 20
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Run tests
run: |
pnpm test
pnpm turbo test:e2e
pnpm turbo test:e2e
cd apps/example && pnpm prisma db seed && cd -
BASE_URL=http://localhost:3000/pagerouter/admin pnpm test:e2e
- uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v3

- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reset-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate
- name: Install dependencies
run: pnpm install
- name: Reset database
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vercel-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2

- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
19 changes: 11 additions & 8 deletions packages/next-admin/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
FieldTemplateProps,
getSubmitButtonOptions,
ObjectFieldTemplateProps,
SubmitButtonProps
SubmitButtonProps,
} from "@rjsf/utils";
import validator from "@rjsf/validator-ajv8";
import clsx from "clsx";
Expand All @@ -26,7 +26,7 @@
useEffect,
useMemo,
useRef,
useState
useState,
} from "react";
import { twMerge } from "tailwind-merge";
import ClientActionDialogProvider from "../context/ClientActionDialogContext";
Expand Down Expand Up @@ -70,6 +70,7 @@

const RichTextField = dynamic(() => import("./inputs/RichText/RichTextField"), {
ssr: false,
loading: () => <div className="h-48 animate-pulse rounded bg-gray-500" />,
});

const widgets: RjsfForm["props"]["widgets"] = {
Expand Down Expand Up @@ -202,7 +203,7 @@
</div>
);
},
[isPending, id]

Check warning on line 206 in packages/next-admin/src/components/Form.tsx

View workflow job for this annotation

GitHub Actions / start

React Hook useMemo has missing dependencies: 'basePath', 'canCreate', 'canDelete', 'canEdit', 'edit', 'resource', 'router', 'runDeletion', 'showMessage', and 't'. Either include them or remove the dependency array
);

const extraErrors: ErrorSchema | undefined = validation?.reduce(
Expand Down Expand Up @@ -302,17 +303,19 @@
setIsPending(false);
}
},
[apiBasePath, id]

Check warning on line 306 in packages/next-admin/src/components/Form.tsx

View workflow job for this annotation

GitHub Actions / start

React Hook useCallback has missing dependencies: 'basePath', 'cleanAll', 'resource', 'router', 'setFormData', 'showMessage', and 't'. Either include them or remove the dependency array
);

const fields: RjsfForm["props"]["fields"] = {
ArrayField: (props: FieldProps) => {
const customInput = customInputs?.[props.name as Field<ModelName>]
const improvedCustomInput = customInput ? cloneElement(customInput, {
...customInput.props,
mode: edit ? "edit" : "create",
}) : undefined;
return ArrayField({ ...props, customInput: improvedCustomInput })
const customInput = customInputs?.[props.name as Field<ModelName>];
const improvedCustomInput = customInput
? cloneElement(customInput, {
...customInput.props,
mode: edit ? "edit" : "create",
})
: undefined;
return ArrayField({ ...props, customInput: improvedCustomInput });
},
NullField,
};
Expand Down Expand Up @@ -566,7 +569,7 @@
/>
);
}),
[submitButton]

Check warning on line 572 in packages/next-admin/src/components/Form.tsx

View workflow job for this annotation

GitHub Actions / start

React Hook useMemo has missing dependencies: 'CustomForm', 'allDisabled', 'extraErrors', 'fields', 'isPending', 'schema', 'schemas', 'setFormData', and 'templates'. Either include them or remove the dependency array
);

return (
Expand Down
Loading