Amir Hossein Hashemi
Explore posts from serversWhen, and what types of errors <ErrorBoundary> catch?
The docs are not clear about exactly what types of errors are caught by
But errors occurring outside the rendering process, for example, in event handlers or after a
<ErrorBoundary>
. My understanding is that:
<ErrorBoundary>
catches any error that occurs during rendering or updating its children. That includes:
- Errors that occur while rendering the JSX.
- Errors that occur within createEffect
, createMemo
, and other synchronous state management primitives.
But errors occurring outside the rendering process, for example, in event handlers or after a
setTimeout
or async work are not caught by error boundaries.
Is that accurate? Are there other scenarios that I'm missing?6 replies
I can't initialize a session
In this code, I use
useSession
to create a session and initialize it with "light"
if it doesn't have a value:
When I start the application for the first time, or when I manually remove the theme
cookie in the devtools and refresh the page, I get this error:
I don't exactly understand why I get the error. In seems like calling useSession
immediately sends the response to the client, so session.update()
fails because the response is already sent. That's not what expected to happen. Am I doing something wrong?4 replies
Using useNavigate within client-only action/query
The docs says:
If you are inside of a cache or action function you will instead [of useNavigate] want to use redirect or reload.Does that include query/actions that only run on the client (don't use
"use server"
)?8 replies
Why 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 genetic-orange 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 conscious-sapphire on 10/20/2023 in #ask-any-question
Why useDelete calls getIdentity from auth-provider?

26 replies
RRefine
•Created by like-gold 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 genetic-orange 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 compatible-crimson 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 rival-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 genetic-orange 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