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
3 changes: 1 addition & 2 deletions examples/demo/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DemoFloatingWindow, StackProvider, StackTheme } from "@stackframe/stack";
import { StackProvider, StackTheme } from "@stackframe/stack";
import { Metadata } from "next";
import React from "react";
import Header from "src/components/header";
Expand All @@ -23,7 +23,6 @@ export default function RootLayout({
<StackProvider app={stackServerApp}>
<StackTheme>
<Provider>
<DemoFloatingWindow />
<div className="flex flex-col h-screen">
<Header />
<div className="flex flex-grow">
Expand Down
14 changes: 12 additions & 2 deletions packages/init-stack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ async function getUpdatedLayout(originalLayout: string): Promise<LayoutResult |
const importInsertLocationM1 =
firstImportLocationM1 ?? (hasStringAsFirstLine ? layout.indexOf("\n") : -1);
const importInsertLocation = importInsertLocationM1 + 1;
const importStatement = `import { StackProvider, StackTheme, DemoFloatingWindow } from "@stackframe/stack";\nimport { stackServerApp } from "../stack";\n`;
const importStatement = `import { StackProvider, StackTheme } from "@stackframe/stack";\nimport { stackServerApp } from "../stack";\n`;
layout =
layout.slice(0, importInsertLocation) +
importStatement +
Expand All @@ -751,7 +751,17 @@ async function getUpdatedLayout(originalLayout: string): Promise<LayoutResult |
return undefined;
}

const insertOpen = "<StackProvider app={stackServerApp}><StackTheme><DemoFloatingWindow />";
const lines = layout.split("\n");
const [bodyOpenEndLine, bodyOpenEndIndexInLine] = getLineIndex(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code could crash when calculating line indices if the body tag's position (bodyOpenEndIndex) extends beyond the total length of concatenated lines. The getLineIndex function throws an error in this case, which isn't caught by the caller. This can happen with malformed HTML or when body tags span multiple lines. The function should handle this edge case gracefully instead of throwing an error.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

lines,
bodyOpenEndIndex
);
const [bodyCloseStartLine, bodyCloseStartIndexInLine] = getLineIndex(
lines,
bodyCloseStartIndex
);

const insertOpen = "<StackProvider app={stackServerApp}><StackTheme>";
const insertClose = "</StackTheme></StackProvider>";

layout =
Expand Down
156 changes: 0 additions & 156 deletions packages/template/src/components/demo-floating-window.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions packages/template/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export { StackTheme } from './providers/theme-provider';

export { AccountSettings } from "./components-page/account-settings";
export { AuthPage } from "./components-page/auth-page";
export { CliAuthConfirmation } from "./components-page/cli-auth-confirm";
export { EmailVerification } from "./components-page/email-verification";
export { ForgotPassword } from "./components-page/forgot-password";
export { PasswordReset } from "./components-page/password-reset";
Expand All @@ -23,6 +22,5 @@ export { OAuthButton } from "./components/oauth-button";
export { OAuthButtonGroup } from "./components/oauth-button-group";
export { SelectedTeamSwitcher } from "./components/selected-team-switcher";
export { UserButton } from "./components/user-button";

export { DemoFloatingWindow } from "./components/demo-floating-window";
export { CliAuthConfirmation } from "./components-page/cli-auth-confirm";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This export statement references a non-existent module. The component 'CliAuthConfirmation' and its containing module './components-page/cli-auth-confirm' appear to be missing from the codebase. This will cause a module resolution error when any consumer tries to import this component. The bug was introduced by keeping an export for a module that doesn't exist in the project structure.


React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)

// END_PLATFORM