diff --git a/CHANGELOG.md b/CHANGELOG.md index da7a4f26a..a93efff0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) -## [unreleased] +## [0.35.5] - 2023-10-05 + +### Fixes + +- Fixed shadow dom issue in nextjs dev mode by checking if a shadow root is already attached to the div before creating one. ### Example changes diff --git a/lib/build/index2.js b/lib/build/index2.js index c43e59660..2b9fda041 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -156,7 +156,11 @@ function WithShadowDom(_a) { if (rootDiv.current) { // defaults from react-shadow setShadowRoot(function (os) { - return os || rootDiv.current.attachShadow({ mode: "open", delegatesFocus: false }); + return ( + os || + rootDiv.current.shadowRoot || + rootDiv.current.attachShadow({ mode: "open", delegatesFocus: false }) + ); }); } }, diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index 4d6e79bf1..a27549731 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1 +1 @@ -export declare const package_version = "0.35.4"; +export declare const package_version = "0.35.5"; diff --git a/lib/ts/components/featureWrapper.tsx b/lib/ts/components/featureWrapper.tsx index 5d857c783..6a4366767 100644 --- a/lib/ts/components/featureWrapper.tsx +++ b/lib/ts/components/featureWrapper.tsx @@ -94,7 +94,12 @@ function WithShadowDom({ children }: PropsWithChildren) { useEffect(() => { if (rootDiv.current) { // defaults from react-shadow - setShadowRoot((os) => os || rootDiv.current!.attachShadow({ mode: "open", delegatesFocus: false })); + setShadowRoot( + (os) => + os || + rootDiv.current!.shadowRoot || + rootDiv.current!.attachShadow({ mode: "open", delegatesFocus: false }) + ); } }, [rootDiv]); diff --git a/lib/ts/version.ts b/lib/ts/version.ts index b08b6a904..c769c2bf4 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,4 +12,4 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const package_version = "0.35.4"; +export const package_version = "0.35.5"; diff --git a/package-lock.json b/package-lock.json index db4eba3ae..ce7194225 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-auth-react", - "version": "0.35.4", + "version": "0.35.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "supertokens-auth-react", - "version": "0.35.4", + "version": "0.35.5", "license": "Apache-2.0", "dependencies": { "intl-tel-input": "^17.0.19", diff --git a/package.json b/package.json index 4038ce709..93f767599 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-auth-react", - "version": "0.35.4", + "version": "0.35.5", "description": "ReactJS SDK that provides login functionality with SuperTokens.", "main": "./index.js", "engines": {