-
Notifications
You must be signed in to change notification settings - Fork 129
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
Fix the framework picker for form #133
Fix the framework picker for form #133
Conversation
@fulopkovacs is attempting to deploy a commit to the Tanstack Team on Vercel. A member of the Team first needs to authorize it. |
@crutchcorn There are a couple of ideas, that that we could add to this PR:
Ofc these are just suggestions, changing routes are scary, plus I know much less about the projects than you do. 🤣 Wdyt? |
@fulopkovacs let's do #1 for sure. I'm less sure about #2 - @tannerlinsley what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think examples
wasn't supposed to be a dynamic segment in this route, because store.$version.docs.framework.$framework.$examples._index.tsx
matches /store/latest/docs/framework/react/quick-start
($examples
: "quick-start"
) and all the other framework-related doc pages.
import { repo, getBranch } from '~/routes/form' | ||
import { DefaultErrorBoundary } from '~/components/DefaultErrorBoundary' | ||
import { seo } from '~/utils/seo' | ||
import { useLoaderData, useParams } from '@remix-run/react' | ||
import { Doc } from '~/components/Doc' | ||
import { loadDocs } from '~/utils/docs' | ||
import { fetchRepoFile } from '~/utils/documents.server' | ||
|
||
export const loader = async (context: LoaderFunctionArgs) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body of the loader
function is basically identical in this file and app/routes/store.$version.docs.framework.$framework.$.tsx
. If we want to follow the DRY practices, we can extract the shared logic to a helper function.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fulopkovacs I noticed that we've seemingly fixed this by making the core
docs duplicate through every framework.
core/quick-start.md -> routes/react/quick-start.md, routes/vue/quick-start.md, etc
This is a clever solution, but unfortunately one we can't move forward with. That would break our doc's SEO pretty bad, as there wouldn't be a canonical URL for core
docs anymore
Instead, let's use some other kind of tool (maybe localstorage + a sidebar refactor?) to solve this issue.
Sure, I can explore other options. We can use |
You're awesome, thank you for your help and receptiveness to feedback. Keep up the amazing work! 🔥 |
Ok, I went with |
@@ -17,7 +17,7 @@ export const loader = async (context: LoaderFunctionArgs) => { | |||
}) | |||
} | |||
|
|||
export const meta: MetaFunction = ({ data }) => { | |||
export const meta: MetaFunction<typeof loader> = ({ data }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the type errors around the meta
functions in the files I worked on. Most of the remaining errors of this kind are getting fixed in #135.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes #129 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, thank you!
return seo({ | ||
title: `${data?.title} | TanStack Form Docs`, | ||
title: `${data?.title} | TanStack Query Docs`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up, this needs to be changed back to Form
app/routes/form.tsx
Outdated
const framework = | ||
params.framework || localStorage.getItem('framework') || 'react' | ||
params.framework || localStorage.getItem(formLocalStorageKey) || 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we couldn't just keep framework
as the key? It would theoretically allow us to preserve which framework is selected across multiple TanStack projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, no specific reason. I just assumed it's not a feature but a bug! I'm changing it back to framework
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, thank you!
app/routes/store.tsx
Outdated
@@ -118,7 +118,7 @@ export const useReactStoreDocsConfig = () => { | |||
const params = useParams() | |||
const version = params.version! | |||
const framework = | |||
params.framework || localStorage.getItem('framework') || 'react' | |||
params.framework || localStorage.getItem(storeLocalStorageKey) || 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking on this again - could we keep it as framework
rather than framework-store
and framework-form
?
…ependent doc pages of the Form project
…mework is selected
3c87c8b
to
10d0d15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great fix, good work!
Two issues has been fixed for the framework picker of the Form project:
❌
main
framework-selector-bad.mp4
✅ This PR
framework-selector-good.mp4