Skip to content

Searchable menus#798

Draft
laasyaaki wants to merge 6 commits intostagingfrom
searchable_menus
Draft

Searchable menus#798
laasyaaki wants to merge 6 commits intostagingfrom
searchable_menus

Conversation

@laasyaaki
Copy link
Copy Markdown
Collaborator

Added menus. Backend @ ScottyLabs/dining-api#251

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmueats Ready Ready Preview Mar 23, 2026 2:35am

Request Review

@laasyaaki laasyaaki marked this pull request as draft March 23, 2026 02:36
@laasyaaki
Copy link
Copy Markdown
Collaborator Author

Going to add clicking on image to expand

Comment on lines +76 to +84
).map(({ default: menuUrl }) => {
const filename = menuUrl.split('/').pop() || '';
return {
src: menuUrl,
alt: filename,
};
});

const menuUrlMap = Object.fromEntries(menuUrls.map((item) => [item.alt, item.src]));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The image lookup logic relies on matching filenames, which will likely fail in production builds where asset filenames are hashed by Vite, preventing images from being displayed.
Severity: HIGH

Suggested Fix

To ensure a reliable lookup, avoid relying on the final filename. Instead, use the original module path keys provided by import.meta.glob directly. The API should provide a path segment that can be used to uniquely identify the image within the src/assets/images/menu_items directory, which can then be used to find the correct key in the imageModules map without splitting the path.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/components/DrawerTabContent.tsx#L76-L84

Potential issue: The component dynamically loads menu images using `import.meta.glob`.
It then finds the correct image by matching a filename from an API response against the
local file path. This logic, which uses `key.split('/').pop()`, assumes the filename in
the production build will match the filename from the API. However, Vite's default
production build process hashes asset filenames (e.g., `image.png` becomes
`image-a1b2c3d4.png`). This will cause the lookup to fail, as the API will provide the
original, unhashed filename, resulting in no menu images being displayed in the
production environment.

Did we get this right? 👍 / 👎 to inform future reviews.

@Arom1a
Copy link
Copy Markdown
Contributor

Arom1a commented Mar 23, 2026

Why do we need the images in the repo? I think we should put them in the database

@cirex-web
Copy link
Copy Markdown
Collaborator

railway bucket store might be a good choice? and then we can just store the urls in the database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants