Skip to content

Commit

Permalink
fix: only add shadow root if there is none attached (#748)
Browse files Browse the repository at this point in the history
* fix: only add shadow root if there is none attached

* chore: bump version number
  • Loading branch information
porcellus authored Oct 6, 2023
1 parent e84e083 commit 6d9fcba
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion lib/build/index2.js

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

2 changes: 1 addition & 1 deletion lib/build/version.d.ts

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

7 changes: 6 additions & 1 deletion lib/ts/components/featureWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ function WithShadowDom({ children }: PropsWithChildren<unknown>) {
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]);

Expand Down
2 changes: 1 addition & 1 deletion lib/ts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 6d9fcba

Please sign in to comment.