Skip to content
Closed
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
4 changes: 2 additions & 2 deletions core/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getSiteVersion } from '@makeswift/runtime/next/server';
import { Analytics } from '@vercel/analytics/react';
import { SpeedInsights } from '@vercel/speed-insights/next';
import { clsx } from 'clsx';
import type { Metadata } from 'next';
import { draftMode } from 'next/headers';
import { notFound } from 'next/navigation';
import { NextIntlClientProvider } from 'next-intl';
import { setRequestLocale } from 'next-intl/server';
Expand Down Expand Up @@ -118,7 +118,7 @@ export default async function RootLayout({ params, children }: Props) {
setRequestLocale(locale);

return (
<MakeswiftProvider previewMode={(await draftMode()).isEnabled}>
<MakeswiftProvider siteVersion={await getSiteVersion()}>
<html className={clsx(fonts.map((f) => f.variable))} lang={locale}>
<head>
<SiteTheme />
Expand Down
13 changes: 9 additions & 4 deletions core/lib/makeswift/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
'use client';

import { ReactRuntimeProvider, RootStyleRegistry } from '@makeswift/runtime/next';
import { ReactRuntimeProvider, RootStyleRegistry, SiteVersion } from '@makeswift/runtime/next';

import { runtime } from '~/lib/makeswift/runtime';
import '~/lib/makeswift/components';

export function MakeswiftProvider({
children,
previewMode,
siteVersion,
}: {
children: React.ReactNode;
previewMode: boolean;
siteVersion: SiteVersion | null;
}) {
return (
<ReactRuntimeProvider previewMode={previewMode} runtime={runtime}>
<ReactRuntimeProvider
apiOrigin={process.env.NEXT_PUBLIC_MAKESWIFT_API_ORIGIN}
appOrigin={process.env.NEXT_PUBLIC_MAKESWIFT_APP_ORIGIN}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since apiOrigin and appOrigin are only applicable internally, I wouldn't expose them by default.

runtime={runtime}
siteVersion={siteVersion}
>
<RootStyleRegistry enableCssReset={false}>{children}</RootStyleRegistry>
</ReactRuntimeProvider>
);
Expand Down
4 changes: 3 additions & 1 deletion core/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { client } from './client';
import { graphql } from './client/graphql';
import { cspHeader } from './lib/content-security-policy';

const withMakeswift = createWithMakeswift();
const withMakeswift = createWithMakeswift({
appOrigin: process.env.NEXT_PUBLIC_MAKESWIFT_APP_ORIGIN,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

});
const withNextIntl = createNextIntlPlugin({
experimental: {
createMessagesDeclaration: './messages/en.json',
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@conform-to/react": "^1.6.1",
"@conform-to/zod": "^1.6.1",
"@icons-pack/react-simple-icons": "^11.2.0",
"@makeswift/runtime": "^0.24.6",
"@makeswift/runtime": "0.0.0-snapshot-20250819213058",
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-checkbox": "^1.3.2",
"@radix-ui/react-dialog": "^1.1.14",
Expand Down
Loading
Loading