question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature]: Expose Remix Context to loaders?

See original GitHub issue

I was converting a bunch of my old “other routes” to resource routes: https://github.com/kentcdodds/kentcdodds.com/commit/514d834d18ca8111a6c128ef101eddde45f43b9f

It was awesome, except for my sitemap.xml route which needs the remixContext to work: https://github.com/kentcdodds/kentcdodds.com/blob/514d834d18ca8111a6c128ef101eddde45f43b9f/app/utils/sitemap.server.ts#L22

The way my sitemap works is it goes through all the route modules and includes them in the sitemap. There’s a default for each route, but there’s also the ability for routes to add a custom getSitemapEntries function on handle: https://github.com/kentcdodds/kentcdodds.com/blob/514d834d18ca8111a6c128ef101eddde45f43b9f/app/utils/sitemap.server.ts#L29

It works really well: https://kentcdodds.com/sitemap.xml

Eventually this could be an open source module that people could easily install and include on their site:

// app/routes/sitemap[.]xml.tsx
export {loader} from 'remix-sitemap'

I’m not sure whether there’s any other way to get access to all the route modules, but in any case, my loader needs access to the route modules as well as the manifest.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kentcdoddscommented, Feb 11, 2022

That won’t work for me because I want to send an XML document, not a React component 😃

2reactions
sdavidscommented, Jan 25, 2022

Should there be a new issue for this sitemap functionality?

Read more comments on GitHub >

github_iconTop Results From Across the Web

loader - Remix
This is the context passed in to your server adapter's getLoadContext() function. It's a way to bridge the gap between the adapter's request/response...
Read more >
Dependency injection in Remix loaders and actions by sergiodxa ...
I'll show you tips and tricks on how to interpret the results, and I'll also expose you to key features that are best...
Read more >
Handle Loading State with Remix useTransition - Egghead.io
Integrate TypeScript Into a Remix Loader Function ... Expose Specific Environmental Variables to The Client Using Remix.
Read more >
@teambit/webpack.modules.generate-expose-loaders | Yarn ...
New Features. Show generated artifacts of a build in code tab (#6550); Introduce a new command bit write-tsconfig to write tsconfig files in...
Read more >
Newest 'remix.run' Questions - Stack Overflow
Ok, so i got in to this problem running query in my app based on: Remix app framework Postgres as a db Prisma...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found