Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(gdpr-cookie-consent): Switch to V2 + Vite #510

Merged
merged 3 commits into from
Jun 16, 2024

Conversation

machour
Copy link
Collaborator

@machour machour commented Jun 16, 2024

No description provided.

});

export default function App() {
export function Layout({ children }: { children: React.ReactNode }) {
const { track } = useLoaderData<typeof loader>();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sergiodxa Little problem here, Layout shouldn't be calling useLoaderData() since it would fail when an error is thrown.

Tried calling useLoaderData() from and pass track in the Outlet (<Outlet context={{ track }} />) but useOutletContext() returns null in Layout (which seems normal since we're still in the same route, not in a descendant).

I'm curious how you would handle this? Dummy ErrorBoundary that doesn't use Layout ? A context ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went with useRouteLoaderData() as a workaround. Still curious about your opinion here!

@machour machour requested a review from sergiodxa June 16, 2024 09:02
@machour machour merged commit 20116af into main Jun 16, 2024
1 check passed
@machour machour deleted the v2-gdpr-cookie-consent branch June 16, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant