Add PhotoLight type and optimize photo grid queries #332
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.
This pull request introduces a new, lightweight
PhotoLighttype for use in grid and homepage photo queries, optimizing data fetching and component rendering by reducing the amount of photo data loaded when full details are unnecessary.The changes update both backend query logic and frontend components to use this lighter type where appropriate, and provide new cached query functions for improved performance.
Key changes include:
PhotoLightinterface insrc/photo/index.ts, representing a subset of photo fields for lightweight queries, and implemented theparsePhotoLightFromDbutility for parsing DB rows into this type. (F267da1fL49R49, F267da1fL133)PhotoGrid,PhotoGridPageClient,PhotoLink,PhotoMedium, and related utility functions) to usePhotoLightinstead of the fullPhototype where only basic photo information is required.getPhotosLightfunction insrc/photo/query.tsto efficiently query only the necessary columns forPhotoLight, and definedPHOTO_LIGHT_COLUMNSfor this purpose.app/page.tsx) and grid page (app/grid/page.tsx) logic to use the newgetPhotosCachedLightfor grid views, and to select between light and full photo queries based on theGRID_HOMEPAGE_ENABLEDflag.PhotoandPhotoLighttypes where needed, and ensured compatibility in utility functions such as sorting and description generation.filmfield inPhotoExifto use theFujifilmSimulationtype for improved type safety.