Skip to content

Commit 5c0e7d9

Browse files
committed
Fix bug where relative urls didn't work
1 parent b2a4699 commit 5c0e7d9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/pages/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useMemo } from 'react';
22
import { GetServerSideProps } from 'next'
33
import MDX from '@mdx-js/runtime';
4-
import App from '../components/app';
4+
import App, { AppProps as IApp } from '../components/app';
55
import Grid from '../components/grid';
66
import useForceHttps, { ForceHttpsStatus, replaceUrlWithHttps } from '../force-https';
77
import { getContainersWithLabels, AppProps } from '../docker';
@@ -51,13 +51,15 @@ const Style : React.FC<{ colors : Colors }> = ({ colors }) => {
5151

5252
const Home : React.FC<Props> = ({ colors, mdx, appData, forceHttps }) => {
5353
const httpStatus = useForceHttps(forceHttps);
54-
const apps = useMemo(() => {
55-
return (appData||[]).map(({
54+
let apps : IApp[] = [];
55+
56+
if(typeof window !== 'undefined') {
57+
apps = (appData||[]).map(({
5658
relativeSubdomain,
5759
url,
5860
...app
5961
}) => {
60-
const href = (relativeSubdomain && typeof window !== 'undefined')
62+
const href = relativeSubdomain
6163
? `//${relativeSubdomain}.${window.location.host}/`
6264
: (url || "");
6365

@@ -67,7 +69,7 @@ const Home : React.FC<Props> = ({ colors, mdx, appData, forceHttps }) => {
6769

6870
return { ...app, href };
6971
});
70-
}, [appData, httpStatus]);
72+
}
7173

7274
return <>
7375
<Style colors={colors} />

0 commit comments

Comments
 (0)