Skip to content

Commit

Permalink
chore (session): refactor query to move lip to make less database que…
Browse files Browse the repository at this point in the history
…ries in its transaction
  • Loading branch information
glencoden committed Feb 1, 2025
1 parent 58b1929 commit 7c416aa
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 267 deletions.
21 changes: 1 addition & 20 deletions apps/cloud/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Logo from '@repo/ui/components/Logo'
import { ExternalLink, LogOut } from 'lucide-react'
import { hasAccess } from '~/helpers/has-access'
import { useUserSession } from '~/hooks/useUserSession'
import songsV1 from '~/songs_v1.json'

export default function Index() {
const navigation = useNavigation()
Expand All @@ -17,24 +16,6 @@ export default function Index() {

const { data: session } = api.session.getCurrent.useQuery()

const { data: songs } = api.song.getAllWithLyrics.useQuery()

if (songs) {
for (const song of songs) {
if (!song.title.endsWith('*👾*')) {
continue
}
const songV1 = songsV1.find((s) =>
s.title.toLocaleLowerCase().endsWith(song.title.toLowerCase()),
)
if (!songV1) {
console.log('song not found', song.title)
continue
}
console.log(song.title, songV1.title, song.lyrics === songV1.lyrics)
}
}

return (
<BoxMain className='flex flex-col items-center'>
<header className='w-full'>
Expand Down Expand Up @@ -115,7 +96,7 @@ export default function Index() {
<li className='w-full'>
<Button variant='light' asChild>
<Link
to='https://rc.tool.looneytunez.de'
to='http://rc.tool.looneytunez.de'
rel='noopener noreferrer'
target='_blank'
>
Expand Down
Loading

0 comments on commit 7c416aa

Please sign in to comment.