Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
node_modules
.DS_store

mise.toml

/build
/server-build
.env
Expand Down
3 changes: 2 additions & 1 deletion app/routes/users+/$username_+/notes.$noteId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export async function loader({ params }: Route.LoaderArgs) {
updatedAt: true,
images: {
select: {
id: true,
altText: true,
objectKey: true,
},
Expand Down Expand Up @@ -123,7 +124,7 @@ export default function NoteRoute({
<div className={`${displayBar ? 'pb-24' : 'pb-12'} overflow-y-auto`}>
<ul className="flex flex-wrap gap-5 py-5">
{loaderData.note.images.map((image) => (
<li key={image.objectKey}>
<li key={image.id}>
<a href={getNoteImgSrc(image.objectKey)}>
<Img
src={getNoteImgSrc(image.objectKey)}
Expand Down
2 changes: 1 addition & 1 deletion app/utils/cache.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { DatabaseSync } from 'node:sqlite'
import {
cachified as baseCachified,
verboseReporter,
Expand All @@ -13,7 +14,6 @@ import {
} from '@epic-web/cachified'
import { remember } from '@epic-web/remember'
import { LRUCache } from 'lru-cache'
import { DatabaseSync } from 'node:sqlite'
import { z } from 'zod'
import { updatePrimaryCacheValue } from '#app/routes/admin+/cache_.sqlite.server.ts'
import { getInstanceInfo, getInstanceInfoSync } from './litefs.server.ts'
Expand Down
18 changes: 10 additions & 8 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ async function seed() {

// Add images to note
const noteImageCount = faker.number.int({ min: 1, max: 3 })
for (let imageIndex = 0; imageIndex < noteImageCount; imageIndex++) {
const imgNumber = faker.number.int({ min: 0, max: 9 })
const noteImage = noteImages[imgNumber]
if (noteImage) {
await prisma.noteImage.create({
const selectedImages = faker.helpers.arrayElements(
noteImages,
noteImageCount,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Array Element Count Mismatch

The faker.helpers.arrayElements call uses a direct number for the count, which, while accepted, can lead to unexpected behavior if noteImages has fewer elements than noteImageCount. This may result in fewer images being created than intended.

Fix in Cursor Fix in Web

await Promise.all(
selectedImages.map((noteImage) =>
prisma.noteImage.create({
data: {
noteId: note.id,
altText: noteImage.altText,
objectKey: noteImage.objectKey,
},
})
}
}
}),
),
)
}
}
console.timeEnd(`👤 Created ${totalUsers} users...`)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/passkey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('Users can register and use passkeys', async ({
navigate,
login,
}) => {
const user = await login()
await login()

const { client, authenticatorId } = await setupWebAuthn(page)

Expand Down