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
7 changes: 7 additions & 0 deletions .changeset/mighty-schools-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"overlay-kit": patch
---

test: fix duplicate overlayId error message expectation

Updated test case to match the actual implementation where duplicate overlayId error messages now include the specific overlayId value for better debugging experience.
4 changes: 3 additions & 1 deletion packages/src/event.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,9 @@ describe('overlay object', () => {
act(() => {
overlay.open(({ isOpen }) => isOpen && <div data-testid="overlay-2" />, { overlayId: sameOverlayId });
});
}).toThrowError("You can't open the multiple overlays with the same overlayId. Please set a different id.");
}).toThrowError(
"You can't open the multiple overlays with the same overlayId(same-overlay-id). Please set a different id."
);
});

it('unmount function requires the exact id to be provided', async () => {
Expand Down
5 changes: 2 additions & 3 deletions packages/src/utils/create-use-external-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { createEmitter } from './emitter';

const emitter = createEmitter();
function useClientLayoutEffect(...args: Parameters<typeof useLayoutEffect>) {

const isBrowser = typeof document !== 'undefined'
const isBrowser = typeof document !== 'undefined';
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';

if ( !isBrowser && !isReactNative) return;
if (!isBrowser && !isReactNative) return;

useLayoutEffect(...args);
}
Expand Down