Skip to content

Commit

Permalink
Merge pull request #220 from storybookjs/cache-versions-response
Browse files Browse the repository at this point in the history
Cache /versions response for 10 min
  • Loading branch information
kylegach authored Aug 12, 2024
2 parents 09a1777 + 8357b0c commit 2a91532
Show file tree
Hide file tree
Showing 4 changed files with 7,747 additions and 4,050 deletions.
22 changes: 10 additions & 12 deletions apps/addon-catalog/components/search-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@ export const SearchResults = ({
{loading ? <div>Loading...</div> : null}
{!loading && searchResults.length === 0 && <div>No results found</div>}
{!loading && searchResults.length > 0 && (
<>
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">
{searchResults.map((item) => (
<Preview
key={item.name}
orientation="vertical"
element={item}
type={item.type === 'Recipe' ? 'recipe' : 'addon'}
/>
))}
</div>
</>
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">
{searchResults.map((item) => (
<Preview
key={item.name}
orientation="vertical"
element={item}
type={item.type === 'Recipe' ? 'recipe' : 'addon'}
/>
))}
</div>
)}
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion apps/frontpage/app/versions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export async function GET(request: NextRequest) {

return new Response(res[0], {
status: 200,
headers: { 'Access-Control-Allow-Origin': '*' },
headers: {
'Access-Control-Allow-Origin': '*',
// Cache for 10 minutes
'Cache-Control': 'public s-max-age=36000',
},
});
}
3 changes: 1 addition & 2 deletions apps/frontpage/components/home/develop/develop.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import React, { useRef } from 'react';
import type { MotionValue } from 'framer-motion';
import { useScroll, useTransform, useSpring, motion } from 'framer-motion';
import Link from 'next/link';
import { ChevronSmallRightIcon } from '@storybook/icons';
Expand All @@ -22,7 +21,7 @@ export function Develop() {
const smoothAppearProgress = useSpring(appearProgress, {
stiffness: 1000,
damping: 100,
}) as MotionValue<number>;
});

// Step 1
const { scrollYProgress: isolationProgress } = useScroll({
Expand Down
Loading

0 comments on commit 2a91532

Please sign in to comment.