Skip to content

Commit

Permalink
fix: remove ssr warning "Detected multiple renderers" (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Apr 12, 2024
1 parent 14bc733 commit c48155b
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 92 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ jobs:
# Branches that will release new versions are defined in .releaserc.json
- run: pnpm exec semantic-release
env:
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
5 changes: 5 additions & 0 deletions figma/package.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ export default defineConfig({
dist: './dist',
src: './src',
tsconfig: './tsconfig.dist.json',
strictOptions: {
alwaysPackageJsonMain: 'off',
alwaysPackageJsonFiles: 'off',
noImplicitBrowsersList: 'off',
},
})
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sanity/ui",
"version": "2.1.2",
"version": "2.1.3-canary.0",
"keywords": [
"sanity",
"ui",
Expand Down Expand Up @@ -119,7 +119,7 @@
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@juggle/resize-observer": "^3.4.0",
"@sanity/pkg-utils": "^6.4.1",
"@sanity/pkg-utils": "^6.6.1",
"@sanity/semantic-release-preset": "^4.1.7",
"@sanity/ui-workshop": "^2.0.12",
"@storybook/addon-a11y": "^8.0.7",
Expand Down Expand Up @@ -197,8 +197,7 @@
"node": ">=14.0.0"
},
"publishConfig": {
"access": "public",
"provenance": true
"access": "public"
},
"esm.sh": {
"bundle": false
Expand Down
71 changes: 38 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/core/components/dialog/dialogContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {createContext} from 'react'
import {globalScope} from '../../lib/globalScope'
import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
import {DialogPosition} from '../../types'

/**
Expand All @@ -14,9 +13,9 @@ export interface DialogContextValue {

const key = Symbol.for('@sanity/ui/context/dialog')

globalScope[key] = globalScope[key] || createContext<DialogContextValue>({version: 0.0})

/**
* @internal
*/
export const DialogContext: React.Context<DialogContextValue> = globalScope[key]
export const DialogContext = createGlobalScopedContext<DialogContextValue>(key, {
version: 0.0,
})
7 changes: 2 additions & 5 deletions src/core/components/menu/menuContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {createContext} from 'react'
import {globalScope} from '../../lib/globalScope'
import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'

export interface MenuContextValue {
version: 0.0
Expand All @@ -26,6 +25,4 @@ export interface MenuContextValue {

const key = Symbol.for('@sanity/ui/context/menu')

globalScope[key] = globalScope[key] || createContext<MenuContextValue | null>(null)

export const MenuContext: React.Context<MenuContextValue | null> = globalScope[key]
export const MenuContext = createGlobalScopedContext<MenuContextValue | null>(key, null)
7 changes: 2 additions & 5 deletions src/core/components/toast/toastContext.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {createContext} from 'react'
import {globalScope} from '../../lib/globalScope'
import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
import {ToastContextValue} from './types'

const key = Symbol.for('@sanity/ui/context/toast')

globalScope[key] = globalScope[key] || createContext<ToastContextValue | null>(null)

export const ToastContext: React.Context<ToastContextValue | null> = globalScope[key]
export const ToastContext = createGlobalScopedContext<ToastContextValue | null>(key, null)

0 comments on commit c48155b

Please sign in to comment.