Skip to content

Commit

Permalink
fix(ui): gallery images set sort
Browse files Browse the repository at this point in the history
  • Loading branch information
sawaYch committed Jun 28, 2024
1 parent 61ca27a commit 5f71f7d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ export const galleryQuery = graphql`
const GalleryPage = ({
...queryResponse
}: PageProps<Queries.GalleryPageQuery>) => {
const data = queryResponse.data.allStrapiGallery.nodes;
const data = useMemo(() => {
const d: GalleryData[] = queryResponse.data.allStrapiGallery
.nodes as unknown as GalleryData[];
return d.map((it) => {
const dd = it;
dd.image = [...it.image.sort((a, b) => a.name.localeCompare(b.name))];
return dd;
});
}, [queryResponse.data.allStrapiGallery.nodes]);

const variants = useMemo(
() => ({
Expand Down

0 comments on commit 5f71f7d

Please sign in to comment.