Skip to content

Commit f375ae7

Browse files
authored
improve package README loading, fix dependencies order (#2121)
1 parent 28b690e commit f375ae7

8 files changed

Lines changed: 30 additions & 30 deletions

File tree

bun.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function Button({
3838
{isLink ? (
3939
<A
4040
href={href}
41-
style={[tw`rounded font-sans`, isLink && containerStyle]}
41+
style={[tw`rounded font-sans no-underline`, containerStyle]}
4242
{...(openInNewTab ? { target: '_blank' } : {})}
4343
{...rest}>
4444
<View focusable={false} style={buttonStyle} accessible={false}>

components/Package/CollapsibleSection.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ export default function CollapsibleSection({ title, data }: Props) {
5757
</View>
5858
{!collapsed && (
5959
<View>
60-
{Object.entries(data).map(([name, version]) => (
61-
<DependencyRow key={`${sectionKey}-${name}`} name={name} version={version} />
62-
))}
60+
{Object.entries(data)
61+
.sort(([aName], [bName]) => aName.localeCompare(bName))
62+
.map(([name, version]) => (
63+
<DependencyRow key={`${sectionKey}-${name}`} name={name} version={version} />
64+
))}
6365
</View>
6466
)}
6567
</>

components/Package/ReadmeBox.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ type Props = {
2828

2929
export default function ReadmeBox({ packageName, githubUrl, isTemplate, loader = false }: Props) {
3030
const { data, error, isLoading } = useSWR(
31-
isTemplate
32-
? `${githubUrl?.replace('github.com/', 'raw.githubusercontent.com/')}/HEAD/README.md`
33-
: `https://unpkg.com/${packageName}/README.md`,
31+
packageName
32+
? isTemplate
33+
? `${githubUrl?.replace('github.com/', 'raw.githubusercontent.com/')}/HEAD/README.md`
34+
: `https://unpkg.com/${packageName}/README.md`
35+
: null,
3436
(url: string) =>
3537
fetch(url).then(res => {
3638
if (res.status === 404) {
@@ -46,11 +48,7 @@ export default function ReadmeBox({ packageName, githubUrl, isTemplate, loader =
4648
}
4749
);
4850

49-
if (!githubUrl || !packageName) {
50-
return null;
51-
}
52-
53-
const readmeFallbackContent = getReadmeFallbackContent(data, isLoading, error);
51+
const readmeFallbackContent = getReadmeFallbackContent(data, isLoading || loader, error);
5452

5553
return (
5654
<View
@@ -61,7 +59,7 @@ export default function ReadmeBox({ packageName, githubUrl, isTemplate, loader =
6159
<P>Readme</P>
6260
</View>
6361
<View style={tw`p-4 pt-3 font-light`}>
64-
{!data && readmeFallbackContent ? (
62+
{(!data && readmeFallbackContent) || !githubUrl ? (
6563
<View style={tw`gap-4 py-6`}>
6664
{isLoading && <ThreeDotsLoader />}
6765
<P style={tw`text-center`}>{readmeFallbackContent}</P>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@radix-ui/react-tooltip": "^1.2.8",
2727
"@react-native-async-storage/async-storage": "^2.2.0",
2828
"@react-native-picker/picker": "^2.11.4",
29-
"@sentry/react": "^10.33.0",
29+
"@sentry/react": "^10.34.0",
3030
"crypto-js": "^4.2.0",
3131
"es-toolkit": "^1.43.0",
3232
"expo": "54.0.31",
@@ -56,7 +56,7 @@
5656
"@expo/next-adapter": "^6.0.0",
5757
"@next/bundle-analyzer": "^16.1.1",
5858
"@prettier/plugin-oxc": "^0.1.3",
59-
"@types/bun": "^1.3.5",
59+
"@types/bun": "^1.3.6",
6060
"@types/crypto-js": "^4.2.2",
6161
"@types/react": "^19.2.8",
6262
"@vercel/blob": "^0.27.3",

pages/api/libraries/check.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
2222
}
2323

2424
res.statusCode = 200;
25-
res.setHeader('Cache-Control', 'public, s-maxage=60, stale-while-revalidate=300');
25+
res.setHeader('Cache-Control', 'public, s-maxage=600, stale-while-revalidate=300');
2626
const result: CheckResultsType = {};
2727
packages.forEach(pkgName => {
2828
result[pkgName] = DATASET[pkgName];

pages/api/libraries/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
111111
: filteredLibraries;
112112
const filteredAndPaginatedLibraries = take(drop(relevanceSortedLibraries, offset), limit);
113113

114-
res.setHeader('Cache-Control', 'public, s-maxage=60, stale-while-revalidate=300');
114+
res.setHeader('Cache-Control', 'public, s-maxage=600, stale-while-revalidate=300');
115115

116116
return res.json({
117117
libraries: filteredAndPaginatedLibraries,

pages/api/libraries/statistic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getNewArchSupportStatus, NewArchSupportStatus } from '~/util/newArchSta
66

77
const DATASET = data as DataAssetType;
88

9-
export default function handler(req: NextApiRequest, res: NextApiResponse) {
9+
export default function handler(_: NextApiRequest, res: NextApiResponse) {
1010
const result: StatisticResultType = {
1111
total: 0,
1212
newArchitecture: 0,
@@ -110,7 +110,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
110110
});
111111

112112
res.setHeader('Content-Type', 'application/json');
113-
res.setHeader('Cache-Control', 'public, s-maxage=60, stale-while-revalidate=300');
113+
res.setHeader('Cache-Control', 'public, s-maxage=600, stale-while-revalidate=300');
114114
res.statusCode = 200;
115115

116116
return res.json(result);

0 commit comments

Comments
 (0)