Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/frontend/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const metadata: Metadata = {
'NEAR Blocks is the leading blockchain explorer dedicated to the NEAR ecosystem. Powered by NEAR Protocol.',
icons: {
apple: '/apple-touch-icon.png',
icon: '/icon.svg',
icon: { sizes: 'any', type: 'image/svg+xml', url: '/icon.svg' },
shortcut: { sizes: '32x32', url: '/favicon.ico' },
},
title: 'Near Protocol Explorer | NearBlocks',
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/search/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export const SearchPopover = ({
/>
</PopoverAnchor>
<PopoverContent
align="start"
className="divide-border w-(--radix-popper-anchor-width) max-w-200 divide-y p-0"
onOpenAutoFocus={(event) => event.preventDefault()}
sideOffset={12}
>
{results && results.accounts.length > 0 && (
Expand Down
20 changes: 18 additions & 2 deletions apps/frontend/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,26 @@ export type Config = z.infer<typeof configSchema>;
export type PublicEnv = z.infer<typeof publicEnvSchema>;
export type ServerEnv = z.infer<typeof serverEnvSchema>;

let cachedServerConfig: null | ServerEnv = null;

export const getServerConfig = (): ServerEnv => {
return serverEnvSchema.parse({ ...process.env });
if (!cachedServerConfig) {
cachedServerConfig = serverEnvSchema.parse({ ...process.env });
}

return cachedServerConfig;
};

let cachedRuntimeConfig: Config | null = null;

export const getRuntimeConfig = (theme: string): Config => {
return configSchema.parse({ ...process.env, providers, theme });
if (!cachedRuntimeConfig) {
cachedRuntimeConfig = configSchema.parse({
...process.env,
providers,
theme,
});
}

return cachedRuntimeConfig;
};
5 changes: 2 additions & 3 deletions apps/frontend/src/lib/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'server-only';

import { getServerConfig, ServerEnv } from './config';

const config: ServerEnv = getServerConfig();
import { getServerConfig } from './config';

export const fetcher = async <T>(url: string, options?: RequestInit) => {
const config = getServerConfig();
const baseUrl = config.API_URL;
const apiKey = config.API_ACCESS_KEY;

Expand Down
Loading