Skip to content

Commit 1340818

Browse files
fix(plugin-multi-tenant): moves getGlobalViewRedirect from utilities to rsc exports (#14817)
After upgrading Next an error surfaced: `Error: Invariant: AsyncLocalStorage accessed in runtime where it is not available`. The `getGlobalViewRedirect` uses Next's `unauthorized` function and should be exported from the rsc directory.
1 parent 22a0255 commit 1340818

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { GlobalViewRedirect } from '../components/GlobalViewRedirect/index.js'
22
export { TenantSelector } from '../components/TenantSelector/index.js'
33
export { TenantSelectionProvider } from '../providers/TenantSelectionProvider/index.js'
4+
export { getGlobalViewRedirect } from '../utilities/getGlobalViewRedirect.js'
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export { defaults } from '../defaults.js'
22
export { filterDocumentsByTenants as getTenantListFilter } from '../filters/filterDocumentsByTenants.js'
3-
export { getGlobalViewRedirect } from '../utilities/getGlobalViewRedirect.js'
43
export { getTenantAccess } from '../utilities/getTenantAccess.js'
54
export { getTenantFromCookie } from '../utilities/getTenantFromCookie.js'
65
export { getUserTenantIDs } from '../utilities/getUserTenantIDs.js'

test/plugin-multi-tenant/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { multiTenantPlugin } from '@payloadcms/plugin-multi-tenant'
2+
import { getTenantFromCookie } from '@payloadcms/plugin-multi-tenant/utilities'
23
import { fileURLToPath } from 'node:url'
34
import path from 'path'
45
const filename = fileURLToPath(import.meta.url)
56
const dirname = path.dirname(filename)
67

78
import type { Config as ConfigType } from './payload-types.js'
89

9-
import { getTenantFromCookie } from '../../packages/plugin-multi-tenant/src/utilities/getTenantFromCookie.js'
1010
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
1111
import { AutosaveGlobal } from './collections/AutosaveGlobal.js'
1212
import { Menu } from './collections/Menu.js'

0 commit comments

Comments
 (0)