Amir Hossein Hashemi
Explore posts from serversWhy submission result doesn't update?
In the component below, it appears that
submission
does not update when the action does not return anything.
Let's say I enter "12" in the input field and submit the form. In this case, submission.result
would be:
After that, I input "34" into the field, which passes the validation. I expected that since the action does not return anything in this scenario, submission.result
should be undefined
and the error message should not be displayed. However, it seems that submission.result
does not update at all. I must return something from the action to update the submission result.
Can you explain why this happens? I couldn't find any documentation about it.8 replies
RRefine
•Created by unwilling-turquoise on 11/8/2023 in #ask-any-question
How to disable authentication in a page?
I'm using the Next.js router provider and I want to disable authentication in specific page, for example
/docs
. How should I do that?12 replies
RRefine
•Created by frozen-sapphire on 10/20/2023 in #ask-any-question
Why useDelete calls getIdentity from auth-provider?
26 replies
RRefine
•Created by ratty-blush on 1/6/2023 in #ask-any-question
Reducing bundle size
The bundle size of my Refine app built with Next.js and Material UI is very high and the app is very slow. I'm looking for ways to reduce the bundle size. This is the bundle:
As you can see
_app.tsx
is very heavy and it effects the whole app performance. How can I reduce it?
One thing I tried was to remove resource page components to see the result:
The fact that I have to import all resource pages in the _app.tsx
file has a significant effect to bundle size and speed of the app. Is there a way to fix it?10 replies
RRefine
•Created by xenophobic-harlequin on 12/12/2022 in #ask-any-question
I can't serve the app from a sub-directory
I want the base path of my app be
/admin/
. So for example the users list page would be /admin/users
. I followed your instructions : Serving the application from a subdirectory
(https://refine.dev/docs/api-reference/core/providers/router-provider/#serving-the-application-from-a-subdirectory)
I have a CustomRouterComponent
component:
And I give it to<Refine>
:
Now when I open /admin
it automatically redirects to /admin/users
which is a good sign but nothing renders on that page and any other page in my app. Am I missing something? I don't get any wired error in the console. I don't get a 404. Just nothing renders. All pages are empty.
I'm using Vite+React+TS+React location. All of my dependencies all up-to-date. I've also tried to set base
to /admin/
in vite.config.ts
but it didn't help:
from6 replies
RRefine
•Created by foreign-sapphire on 12/11/2022 in #ask-any-question
How to transform query results before passing them to `useForm`?
My api returns a JSON string in one of its endpoints. Something like this
I use this field with react-hook-form's
useFieldArray
to show an array of input fields to edit each list item.
but because list
is a string and not an array it doesn't work. What's the best way to convert list
to JSON before useForm
hook use it? I'm trying to avoid updating my data providers as much as possible because they are already messy. Is there any way to achieve this without updating data providers?6 replies
RRefine
•Created by xenial-black on 12/1/2022 in #ask-any-question
How to transform form data before passing it to data provider?
I have an edit page that should only send changed fields to the server instead of the whole form data. Therefore I need a way to transform the form data before passing it to data provider. What's the best way to do that? I'm using React.js with react-hook-form integration.
4 replies
RRefine
•Created by rival-black on 11/23/2022 in #ask-any-question
How to disable some filter operators?
My server only supports the
eq
filter operator and I want to disable the other operators. I don't want my users accidentally select an unsupported operator in the filter form. How can I do that? btw I'm using material ui.5 replies