Solved search string issue by updating router.

This commit is contained in:
Jesse Brault 2024-08-07 13:12:16 -05:00
parent 3ea7f6f83a
commit 73cdf19ac6
3 changed files with 14691 additions and 14682 deletions

49
package-lock.json generated
View File

@ -14,7 +14,7 @@
"@fortawesome/react-fontawesome": "^0.2.2",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.51.21",
"@tanstack/react-router": "^1.38.1",
"@tanstack/react-router": "^1.46.8",
"@tanstack/router-devtools": "^1.39.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@ -5853,9 +5853,10 @@
}
},
"node_modules/@tanstack/history": {
"version": "1.31.16",
"resolved": "https://registry.npmjs.org/@tanstack/history/-/history-1.31.16.tgz",
"integrity": "sha512-rahAZXlR879P7dngDH7BZwGYiODA9D5Hqo6nUHn9GAURcqZU5IW0ZiT54dPtV5EPES7muZZmknReYueDHs7FFQ==",
"version": "1.45.3",
"resolved": "https://registry.npmjs.org/@tanstack/history/-/history-1.45.3.tgz",
"integrity": "sha512-n4XXInV9irIq0obRvINIkESkGk280Q+xkIIbswmM0z9nAu2wsIRZNvlmPrtYh6bgNWtItOWWoihFUjLTW8g6Jg==",
"license": "MIT",
"engines": {
"node": ">=12"
},
@ -5918,13 +5919,14 @@
}
},
"node_modules/@tanstack/react-router": {
"version": "1.39.4",
"resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.39.4.tgz",
"integrity": "sha512-Pby5MI1NREiXcX532HqQIa9bzwqxFypnqDiPIbywNP1BXufvCuzRh1ZQX/IxxYLeqjANE2gjTmAGHeyrEoh1kg==",
"version": "1.46.8",
"resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.46.8.tgz",
"integrity": "sha512-9hQ2c/641tI2658iE+yNIHSRAjfuV9KWEP9siueP0PuMVU34Jnb8+26OazvOQTOa8yXC3VCQUMK+q8ZlCCw7BQ==",
"license": "MIT",
"dependencies": {
"@tanstack/history": "1.31.16",
"@tanstack/react-store": "^0.2.1",
"tiny-invariant": "^1.3.1",
"@tanstack/history": "1.45.3",
"@tanstack/react-store": "^0.5.5",
"tiny-invariant": "^1.3.3",
"tiny-warning": "^1.0.3"
},
"engines": {
@ -5935,25 +5937,26 @@
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
"react": ">=18",
"react-dom": ">=18"
}
},
"node_modules/@tanstack/react-store": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@tanstack/react-store/-/react-store-0.2.1.tgz",
"integrity": "sha512-tEbMCQjbeVw9KOP/202LfqZMSNAVi6zYkkp1kBom8nFuMx/965Hzes3+6G6b/comCwVxoJU8Gg9IrcF8yRPthw==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@tanstack/react-store/-/react-store-0.5.5.tgz",
"integrity": "sha512-1orYXGatBqXCYKuroFwV8Ll/6aDa5E3pU6RR4h7RvRk7TmxF1+zLCsWALZaeijXkySNMGmvawSbUXRypivg2XA==",
"license": "MIT",
"dependencies": {
"@tanstack/store": "0.1.3",
"use-sync-external-store": "^1.2.0"
"@tanstack/store": "0.5.5",
"use-sync-external-store": "^1.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"react": ">=16",
"react-dom": ">=16"
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
}
},
"node_modules/@tanstack/router-devtools": {
@ -6027,9 +6030,10 @@
}
},
"node_modules/@tanstack/store": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@tanstack/store/-/store-0.1.3.tgz",
"integrity": "sha512-GnolmC8Fr4mvsHE1fGQmR3Nm0eBO3KnZjDU0a+P3TeQNM/dDscFGxtA7p31NplQNW3KwBw4t1RVFmz0VeKLxcw==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@tanstack/store/-/store-0.5.5.tgz",
"integrity": "sha512-EOSrgdDAJExbvRZEQ/Xhh9iZchXpMN+ga1Bnk8Nmygzs8TfiE6hbzThF+Pr2G19uHL6+DTDTHhJ8VQiOd7l4tA==",
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
@ -14169,6 +14173,7 @@
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz",
"integrity": "sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==",
"license": "MIT",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}

View File

@ -18,7 +18,7 @@
"@fortawesome/react-fontawesome": "^0.2.2",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-query-devtools": "^5.51.21",
"@tanstack/react-router": "^1.38.1",
"@tanstack/react-router": "^1.46.8",
"@tanstack/router-devtools": "^1.39.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View File

@ -1,4 +1,4 @@
import { useQuery } from '@tanstack/react-query'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { createFileRoute, useParams } from '@tanstack/react-router'
import getRecipe from '../../api/getRecipe'
import { useAuth } from '../../auth'
@ -10,11 +10,13 @@ export const Route = createFileRoute('/recipes/$username/$slug')({
from: '/recipes/$username/$slug'
})
const authContext = useAuth()
const queryClient = useQueryClient()
const {
isLoading,
error,
data: recipe
} = useQuery({
} = useQuery(
{
queryKey: ['recipe', username, slug],
queryFn({ signal: abortSignal }) {
return getRecipe({
@ -24,7 +26,9 @@ export const Route = createFileRoute('/recipes/$username/$slug')({
slug
})
}
})
},
queryClient
)
if (isLoading) {
return 'Loading...'
} else if (error !== null) {