diff --git a/e2e/site/app/suspense-fallback/layout.tsx b/e2e/site/app/suspense-fallback/layout.tsx
new file mode 100644
index 000000000..58736cca6
--- /dev/null
+++ b/e2e/site/app/suspense-fallback/layout.tsx
@@ -0,0 +1,17 @@
+import { SWRConfig } from 'swr'
+
+function createPromiseData(data: any, timeout: number) {
+ return new Promise(resolve => {
+ setTimeout(() => {
+ resolve(data)
+ }, timeout)
+ })
+}
+
+export default function Layout({ children }: { children: React.ReactNode }) {
+ const fallback = {
+ '/api/promise': createPromiseData({ value: 'async promise' }, 2000)
+ }
+
+ return {children}
+}
diff --git a/e2e/site/app/suspense-fallback/promise/page.tsx b/e2e/site/app/suspense-fallback/promise/page.tsx
new file mode 100644
index 000000000..a4cede090
--- /dev/null
+++ b/e2e/site/app/suspense-fallback/promise/page.tsx
@@ -0,0 +1,9 @@
+'use client'
+
+import useSWR from 'swr'
+
+export default function Page() {
+ const { data, isLoading } = useSWR('/api/promise')
+
+ return
{isLoading ? 'loading...' : data?.value}
+}
diff --git a/e2e/site/next.config.js b/e2e/site/next.config.js
index 950e2f42e..767719fc4 100644
--- a/e2e/site/next.config.js
+++ b/e2e/site/next.config.js
@@ -1,8 +1,4 @@
/** @type {import('next').NextConfig} */
-const nextConfig = {
- experimental: {
- serverActions: true,
- },
-}
+const nextConfig = {}
module.exports = nextConfig
diff --git a/e2e/site/package.json b/e2e/site/package.json
index 241b88d99..16912f9ed 100644
--- a/e2e/site/package.json
+++ b/e2e/site/package.json
@@ -12,7 +12,7 @@
"@types/node": "^20.2.5",
"@types/react": "^18.2.8",
"@types/react-dom": "18.2.4",
- "next": "^13.4.4",
+ "next": "^14.1.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "5.1.3",
diff --git a/e2e/test/suspense-fallback.test.ts b/e2e/test/suspense-fallback.test.ts
new file mode 100644
index 000000000..d917195e1
--- /dev/null
+++ b/e2e/test/suspense-fallback.test.ts
@@ -0,0 +1,11 @@
+/* eslint-disable testing-library/prefer-screen-queries */
+import { test, expect } from '@playwright/test'
+
+test.describe('suspense fallback', () => {
+ test('should wait for promise fallback value to be resolved', async ({
+ page
+ }) => {
+ await page.goto('./suspense-fallback/promise', { waitUntil: 'commit' })
+ await expect(page.getByText('async promise')).toBeVisible()
+ })
+})
diff --git a/package.json b/package.json
index 8efa7fb7f..26c1c8f54 100644
--- a/package.json
+++ b/package.json
@@ -145,7 +145,7 @@
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"lint-staged": "13.2.2",
- "next": "14.1.0",
+ "next": "14.1.4",
"prettier": "2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fd832f07e..ece8a9d92 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -81,8 +81,8 @@ importers:
specifier: 13.2.2
version: 13.2.2
next:
- specifier: 14.1.0
- version: 14.1.0(react-dom@18.2.0)(react@18.2.0)
+ specifier: 14.1.4
+ version: 14.1.4(react-dom@18.2.0)(react@18.2.0)
prettier:
specifier: 2.8.8
version: 2.8.8
@@ -863,12 +863,12 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.15
dev: true
- /@next/env@14.1.0:
- resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==}
+ /@next/env@14.1.4:
+ resolution: {integrity: sha512-e7X7bbn3Z6DWnDi75UWn+REgAbLEqxI8Tq2pkFOFAMpWAWApz/YCUhtWMWn410h8Q2fYiYL7Yg5OlxMOCfFjJQ==}
dev: true
- /@next/swc-darwin-arm64@14.1.0:
- resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==}
+ /@next/swc-darwin-arm64@14.1.4:
+ resolution: {integrity: sha512-ubmUkbmW65nIAOmoxT1IROZdmmJMmdYvXIe8211send9ZYJu+SqxSnJM4TrPj9wmL6g9Atvj0S/2cFmMSS99jg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
@@ -876,8 +876,8 @@ packages:
dev: true
optional: true
- /@next/swc-darwin-x64@14.1.0:
- resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==}
+ /@next/swc-darwin-x64@14.1.4:
+ resolution: {integrity: sha512-b0Xo1ELj3u7IkZWAKcJPJEhBop117U78l70nfoQGo4xUSvv0PJSTaV4U9xQBLvZlnjsYkc8RwQN1HoH/oQmLlQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
@@ -885,8 +885,8 @@ packages:
dev: true
optional: true
- /@next/swc-linux-arm64-gnu@14.1.0:
- resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==}
+ /@next/swc-linux-arm64-gnu@14.1.4:
+ resolution: {integrity: sha512-457G0hcLrdYA/u1O2XkRMsDKId5VKe3uKPvrKVOyuARa6nXrdhJOOYU9hkKKyQTMru1B8qEP78IAhf/1XnVqKA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -894,8 +894,8 @@ packages:
dev: true
optional: true
- /@next/swc-linux-arm64-musl@14.1.0:
- resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==}
+ /@next/swc-linux-arm64-musl@14.1.4:
+ resolution: {integrity: sha512-l/kMG+z6MB+fKA9KdtyprkTQ1ihlJcBh66cf0HvqGP+rXBbOXX0dpJatjZbHeunvEHoBBS69GYQG5ry78JMy3g==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -903,8 +903,8 @@ packages:
dev: true
optional: true
- /@next/swc-linux-x64-gnu@14.1.0:
- resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==}
+ /@next/swc-linux-x64-gnu@14.1.4:
+ resolution: {integrity: sha512-BapIFZ3ZRnvQ1uWbmqEGJuPT9cgLwvKtxhK/L2t4QYO7l+/DxXuIGjvp1x8rvfa/x1FFSsipERZK70pewbtJtw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -912,8 +912,8 @@ packages:
dev: true
optional: true
- /@next/swc-linux-x64-musl@14.1.0:
- resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==}
+ /@next/swc-linux-x64-musl@14.1.4:
+ resolution: {integrity: sha512-mqVxTwk4XuBl49qn2A5UmzFImoL1iLm0KQQwtdRJRKl21ylQwwGCxJtIYo2rbfkZHoSKlh/YgztY0qH3wG1xIg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -921,8 +921,8 @@ packages:
dev: true
optional: true
- /@next/swc-win32-arm64-msvc@14.1.0:
- resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==}
+ /@next/swc-win32-arm64-msvc@14.1.4:
+ resolution: {integrity: sha512-xzxF4ErcumXjO2Pvg/wVGrtr9QQJLk3IyQX1ddAC/fi6/5jZCZ9xpuL9Tzc4KPWMFq8GGWFVDMshZOdHGdkvag==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
@@ -930,8 +930,8 @@ packages:
dev: true
optional: true
- /@next/swc-win32-ia32-msvc@14.1.0:
- resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==}
+ /@next/swc-win32-ia32-msvc@14.1.4:
+ resolution: {integrity: sha512-WZiz8OdbkpRw6/IU/lredZWKKZopUMhcI2F+XiMAcPja0uZYdMTZQRoQ0WZcvinn9xZAidimE7tN9W5v9Yyfyw==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
@@ -939,8 +939,8 @@ packages:
dev: true
optional: true
- /@next/swc-win32-x64-msvc@14.1.0:
- resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==}
+ /@next/swc-win32-x64-msvc@14.1.4:
+ resolution: {integrity: sha512-4Rto21sPfw555sZ/XNLqfxDUNeLhNYGO2dlPqsnuCg8N8a2a9u1ltqBOPQ4vj1Gf7eJC0W2hHG2eYUHuiXgY2w==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@@ -4348,8 +4348,8 @@ packages:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
dev: true
- /next@14.1.0(react-dom@18.2.0)(react@18.2.0):
- resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==}
+ /next@14.1.4(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-1WTaXeSrUwlz/XcnhGTY7+8eiaFvdet5z9u3V2jb+Ek1vFo0VhHKSAIJvDWfQpttWjnyw14kBeq28TPq7bTeEQ==}
engines: {node: '>=18.17.0'}
hasBin: true
peerDependencies:
@@ -4363,7 +4363,7 @@ packages:
sass:
optional: true
dependencies:
- '@next/env': 14.1.0
+ '@next/env': 14.1.4
'@swc/helpers': 0.5.2
busboy: 1.6.0
caniuse-lite: 1.0.30001587
@@ -4373,15 +4373,15 @@ packages:
react-dom: 18.2.0(react@18.2.0)
styled-jsx: 5.1.1(react@18.2.0)
optionalDependencies:
- '@next/swc-darwin-arm64': 14.1.0
- '@next/swc-darwin-x64': 14.1.0
- '@next/swc-linux-arm64-gnu': 14.1.0
- '@next/swc-linux-arm64-musl': 14.1.0
- '@next/swc-linux-x64-gnu': 14.1.0
- '@next/swc-linux-x64-musl': 14.1.0
- '@next/swc-win32-arm64-msvc': 14.1.0
- '@next/swc-win32-ia32-msvc': 14.1.0
- '@next/swc-win32-x64-msvc': 14.1.0
+ '@next/swc-darwin-arm64': 14.1.4
+ '@next/swc-darwin-x64': 14.1.4
+ '@next/swc-linux-arm64-gnu': 14.1.4
+ '@next/swc-linux-arm64-musl': 14.1.4
+ '@next/swc-linux-x64-gnu': 14.1.4
+ '@next/swc-linux-x64-musl': 14.1.4
+ '@next/swc-win32-arm64-msvc': 14.1.4
+ '@next/swc-win32-ia32-msvc': 14.1.4
+ '@next/swc-win32-x64-msvc': 14.1.4
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
diff --git a/src/index/config.ts b/src/index/config.ts
new file mode 100644
index 000000000..b5e796c17
--- /dev/null
+++ b/src/index/config.ts
@@ -0,0 +1,5 @@
+'use client'
+
+// TODO: fix SWRConfig re-use issue with bundler
+import { SWRConfig as S } from '../_internal'
+export const SWRConfig = S
diff --git a/src/index/index.react-server.ts b/src/index/index.react-server.ts
index 8d7329654..ad596e7ca 100644
--- a/src/index/index.react-server.ts
+++ b/src/index/index.react-server.ts
@@ -1,2 +1,2 @@
export { unstable_serialize } from '../core/serialize'
-export { SWRConfig } from '../_internal'
+export { SWRConfig } from './config'