-
Notifications
You must be signed in to change notification settings - Fork 131
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
Merged
crutchcorn
merged 13 commits into
TanStack:main
from
fulopkovacs:fix-the-framework-picker-for-form
Jan 15, 2024
+18
−11
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
25149c1
Make it possible to select a framework when viewing the framework-ind…
fulopkovacs d3e3660
Do not default to React for the core docs of the Form, if another fra…
fulopkovacs 3f94fec
Fix the framework picker for the Store project too
fulopkovacs fb77b91
Minor styling and wording updates
fulopkovacs 83bae65
Use urlSearchParams to view the selected framework
fulopkovacs 34ec875
Use local storage
fulopkovacs 8e3e568
Hopefully final touches
fulopkovacs fdf0bec
Revert some redundant changes
fulopkovacs 9d5488e
Fix an incorrect page title
fulopkovacs d0ca90e
Save the selected framework under the same key both in form and store
fulopkovacs 10d0d15
Typo
fulopkovacs 2e6efb0
Fix a Prettier warning
fulopkovacs 9c3047d
fix: dropdown picker no longer breaks
crutchcorn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix the framework picker for the Store project too
commit 3f94fecb037f89209398ec74993ebde98650f466
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,10 @@ | ||
import type { LoaderFunctionArgs, MetaFunction } from '@remix-run/node' | ||
import { repo, getBranch } from '~/routes/store' | ||
import { DefaultErrorBoundary } from '~/components/DefaultErrorBoundary' | ||
import { seo } from '~/utils/seo' | ||
import { useLoaderData, useParams } from '@remix-run/react' | ||
import { loadDocs } from '~/utils/docs' | ||
import { Doc } from '~/components/Doc' | ||
import { redirect, type LoaderFunctionArgs } from '@remix-run/node' | ||
|
||
export const loader = async (context: LoaderFunctionArgs) => { | ||
const { '*': docsPath, version } = context.params | ||
const { '*': docsPath } = context.params | ||
|
||
return loadDocs({ | ||
repo, | ||
branch: getBranch(version), | ||
docPath: `docs/${docsPath}`, | ||
redirectPath: context.request.url.replace(/\/docs.*/, ``), | ||
}) | ||
} | ||
|
||
export const meta: MetaFunction = ({ data }) => { | ||
return seo({ | ||
title: `${data?.title} | TanStack Store Docs`, | ||
description: data?.description, | ||
}) | ||
} | ||
|
||
export const ErrorBoundary = DefaultErrorBoundary | ||
|
||
export default function RouteDocs() { | ||
const { title, code, filePath } = useLoaderData<typeof loader>() | ||
const { version } = useParams() | ||
const branch = getBranch(version) | ||
return ( | ||
<Doc | ||
title={title} | ||
code={code} | ||
repo={repo} | ||
branch={branch} | ||
filePath={filePath} | ||
/> | ||
throw redirect( | ||
// By default we'll redirect to the React docs | ||
context.request.url.replace(/\/docs.*/, `/docs/framework/react/${docsPath}`) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. This is awesome, thank you! |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, becausestore.$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.