Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/popular-squids-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/clerk-js': patch
---

The [issue #1557](https://github.com/clerkinc/javascript/issues/1557) uncovered that when using `@clerk/nextjs` together with `next-intl` the error `"Failed to execute 'removeChild' on 'Node'"` was thrown.

That error came from `@floating-ui/react` which `@clerk/clerk-js` used under the hood. Its version was upgraded from `0.19.0` to `0.25.4` to fix this error.

This error is probably not isolated to `next-intl` so if you encountered a similar error in the past, try upgrading.
54 changes: 26 additions & 28 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 packages/clerk-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@clerk/types": "^3.51.0",
"@emotion/cache": "11.10.5",
"@emotion/react": "11.10.5",
"@floating-ui/react": "0.19.0",
"@floating-ui/react": "0.25.4",
"@zxcvbn-ts/core": "2.2.1",
"@zxcvbn-ts/language-common": "3.0.2",
"browser-tabs-lock": "1.2.15",
Expand Down
10 changes: 7 additions & 3 deletions packages/clerk-js/src/ui/hooks/usePopover.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { UseFloatingProps } from '@floating-ui/react';
import type { UseFloatingOptions } from '@floating-ui/react';
import { autoUpdate, flip, offset, shift, useDismiss, useFloating, useFloatingNodeId } from '@floating-ui/react';
import React, { useEffect } from 'react';

type UsePopoverProps = {
defaultOpen?: boolean;
placement?: UseFloatingProps['placement'];
placement?: UseFloatingOptions['placement'];
offset?: Parameters<typeof offset>[0];
autoUpdate?: boolean;
outsidePress?: boolean | ((event: MouseEvent) => boolean);
Expand All @@ -22,14 +22,18 @@ export const usePopover = (props: UsePopoverProps = {}) => {
const { bubbles = true, outsidePress } = props;
const [isOpen, setIsOpen] = React.useState(props.defaultOpen || false);
const nodeId = useFloatingNodeId();
const { update, reference, floating, strategy, x, y, context } = useFloating({
const { update, refs, strategy, x, y, context } = useFloating({
open: isOpen,
onOpenChange: setIsOpen,
nodeId,
whileElementsMounted: props.autoUpdate === false ? undefined : autoUpdate,
placement: props.placement || 'bottom-start',
middleware: [offset(props.offset || 6), flip(), shift()],
});
// Names are aliased because in @floating-ui/react-dom@2.0.0 the top-level elements were removed
// This keeps the API shape for consumers of usePopover
// @see https://github.com/floating-ui/floating-ui/releases/tag/%40floating-ui%2Freact-dom%402.0.0
const { setReference: reference, setFloating: floating } = refs;

useDismiss(context, {
bubbles,
Expand Down