refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
28.38k stars 2.2k forks source link

[DOC] react-hook-form useForm hook example #3726

Closed kle-hexe closed 4 months ago

kle-hexe commented 1 year ago

Documentation issue

the code given as example at https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#resource

useForm({
    resource: "categories",
});

is not correct. It does not work. the code exmple for id down the page: https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#id

is correct and works

useForm({
    refineCoreProps: {
        action: "edit", // or clone
        resource: "categories",
        id: 1, // <BASE_URL_FROM_DATA_PROVIDER>/categories/1
    },
});

but it won't be found by the ones who search for resource

Describe the thing to improve

correct example were:

useForm({
    refineCoreProps: {
        resource: "categories",
    },
});

Describe the solution (optional)

useForm({
    refineCoreProps: {
        resource: "categories",
    },
});
BatuhanW commented 1 year ago

Thanks for the report @kle-hexe, we'll check and get back to you.

ritute commented 4 months ago

I ran into this issue as well. The docs are still out of date for these: https://refine.dev/docs/packages/react-hook-form/introduction/#installation & https://refine.dev/docs/data/hooks/use-form/#parameters

BatuhanW commented 4 months ago

Hey @ritute nice catch! It seems it's fixed here but not on index pages.

Feel free to create a PR for this one!

Please make sure to thoroughly read and follow our contribution guide. PRs that doesn't follow our contribution guide, will be closed.

https://refine.dev/docs/guides-concepts/contributing/

ritute commented 4 months ago

Encountered this error when following the steps here:

cd documentation
pnpm install
pnpm dev:docs
Module not found: Error: Can't resolve 'buffer' in '/Users/ritute/Code/refine/documentation/src/components/live-preview'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
    - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "buffer": false }
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/ritute/Code/refine/documentation/node_modules/.pnpm/@codesandbox+sandpack-react@2.13.10_@lezer+common@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@codesandbox/sandpack-react/dist'
Did you mean 'jsx-runtime.js'?
BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
client (webpack 5.91.0) compiled with 2 errors
ritute commented 4 months ago

@BatuhanW PR here

BatuhanW commented 4 months ago

Encountered this error when following the steps here:

cd documentation
pnpm install
pnpm dev:docs
Module not found: Error: Can't resolve 'buffer' in '/Users/ritute/Code/refine/documentation/src/components/live-preview'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
  - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "buffer": false }
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/ritute/Code/refine/documentation/node_modules/.pnpm/@codesandbox+sandpack-react@2.13.10_@lezer+common@1.2.1_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@codesandbox/sandpack-react/dist'
Did you mean 'jsx-runtime.js'?
BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
client (webpack 5.91.0) compiled with 2 errors

Btw, do you still have this issue?

ritute commented 4 months ago

I do yeah. I just used MD preview instead since didn’t need the app running for these changes.

On Fri, Jul 12, 2024 at 10:05 AM Batuhan Wilhelm @.***> wrote:

Encountered this error when following the steps here https://refine.dev/docs/guides-concepts/contributing/#working-on-documentation :

cd documentation pnpm install pnpm dev:docs

Module not found: Error: Can't resolve 'buffer' in '/Users/ritute/Code/refine/documentation/src/components/live-preview' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

  • add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
  • install 'buffer' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "buffer": false } Module not found: Error: Can't resolve 'react/jsx-runtime' in @.**@*.**@*.**@*.**@*.**@*.**@*.**@./sandpack-react/dist' Did you mean 'jsx-runtime.js'? BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. client (webpack 5.91.0) compiled with 2 errors

Btw, do you still have this issue?

— Reply to this email directly, view it on GitHub https://github.com/refinedev/refine/issues/3726#issuecomment-2225659809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVZ47LNBVQ2WN5GVW72S3ZL7PCXAVCNFSM6AAAAABKTPORVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRVGY2TSOBQHE . You are receiving this because you were assigned.Message ID: @.***>