Skip to content

Commit

Permalink
feat: pass query params to component
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWielga committed Nov 19, 2024
1 parent 91b2598 commit b0e8b7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/FederatedComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ export function FederatedComponent<P extends NonNullable<unknown>>({
scope,
...props
}: FederatedComponentProps<P> & Pick<FederatedModuleProviderProps, "fallback" | "buildHash">) {
const [, scopeValue] = splitUrl(url as ModuleUrl);
const [, scopeValue, , , , query] = splitUrl(url as ModuleUrl);

const searchParams = new URLSearchParams(query);
const params = Object.fromEntries(searchParams.entries());

return (
<FederatedModuleProvider url={url} fallback={fallback} buildHash={buildHash}>
<Component scope={scope || scopeValue} {...props} />
<Component scope={scope || scopeValue} {...params} {...props} />
</FederatedModuleProvider>
);
}
Expand Down

0 comments on commit b0e8b7e

Please sign in to comment.