mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
fix: open in new tab not working in ios (#5037)
This commit is contained in:
parent
8ac36ceae6
commit
442828e712
@ -202,6 +202,8 @@ export const CodeDemo: React.FC<CodeDemoProps> = ({
|
||||
demo: title,
|
||||
});
|
||||
|
||||
const newTab = window.open(undefined, "_blank");
|
||||
|
||||
const {data, error} = await openInChat({
|
||||
component,
|
||||
title,
|
||||
@ -213,6 +215,7 @@ export const CodeDemo: React.FC<CodeDemoProps> = ({
|
||||
setIsLoading(false);
|
||||
|
||||
if (error || !data) {
|
||||
if (newTab) newTab.close();
|
||||
posthog.capture("CodeDemo - Open in Chat Error", {
|
||||
component,
|
||||
demo: title,
|
||||
@ -228,7 +231,7 @@ export const CodeDemo: React.FC<CodeDemoProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
window.open(data, "_blank");
|
||||
if (newTab) newTab.location.href = data;
|
||||
}, [pathname, title, files, posthog]);
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user