useSWRConfig doesn't pass Global config down to federated modules #2495
Unanswered
agentmilindu
asked this question in
Q&A
Replies: 3 comments 2 replies
-
So both side ( Host app and federated module) using the same version of swr in this case ? |
Beta Was this translation helpful? Give feedback.
2 replies
-
I think you're using vite-module-federation v1.2, try downgrading it to v1.1.14 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Could you try this again with v2.2.5? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bug report
I'm trying to use
SWRConfig
&useSWRConfig
in my micro-frontend application. I was able to getuseSWR()
in Federated Module working without an issue with configs defined in the Main Application via<SWRConfig />
, but when I try to get the config fromuseSWRConfig
hook in the Federated Module , it's giving me the following error.useSWRConfig
is simplyundefined
. I understanduseSWRConfig
is making use of React Contexts and it doesn't work through federated modules. However, if theuseSWR(url)
was able to work correctly using the config set viaSWRConfig
, then that means the configs got passed from the Main Application to the Federated Module, right?Description / Observed Behavior
useSWRConfig
wasundefined
.Expected Behavior
useSWRConfig
should not beundefined
and should be able to provide the Global Config down to the Federated Modules also.Repro Steps / Code Example
A simplified setup of my application is as follows.
Main application
Federated module
My Vite config in the Main looks like this.
My Vite config in the Federated Module looks like this.
Additional Context
SWR version.
2.0.0
Beta Was this translation helpful? Give feedback.
All reactions