Skip to content

Conversation

Abhi1992002
Copy link
Contributor

The issue we’re facing is that we have Next.js metadata in layout.tsx that sets the title of the entire application. It’s a default title, but we need the dynamic document title for the builder’s page. Since the builder’s page is client-side, we use useEffect and document.title for this purpose. However, there’s a problem with this approach. Initially, we mount the title, but as we hydrate the server-side metadata, it gets removed and replaced with the layout’s default title.

Screenshot 2025-10-06 at 10 31 07 AM

Changes 🏗️

  • I’ve converted the page to server-side.
  • Transferred all client-side code to a client component and imported it into the server-side page.

Tests

  • Saving and loading of graphs is working perfectly.
  • The builder’s dynamic title is set perfectly.

- Refactored BuilderPage to utilize MainBuilderPage component for better structure.
- Enhanced metadata generation in the page to dynamically set titles based on flowID and flowVersion.
- Removed legacy FlowEditor component and related onboarding logic for cleaner code.
- Improved error handling for missing graph data to ensure consistent user experience.
@Abhi1992002 Abhi1992002 requested a review from a team as a code owner October 6, 2025 05:01
@Abhi1992002 Abhi1992002 requested review from Pwuts and Bentlybro and removed request for a team October 6, 2025 05:01
@github-project-automation github-project-automation bot moved this to 🆕 Needs initial review in AutoGPT development kanban Oct 6, 2025
@github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Oct 6, 2025
@github-actions github-actions bot added the size/l label Oct 6, 2025
Copy link

deepsource-io bot commented Oct 6, 2025

Here's the code health analysis summary for commits 4e1557e..c8b5032. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
❗ 2 occurences introduced
🎯 1 occurence resolved
View Check ↗
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

qodo-merge-pro bot commented Oct 6, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Error Handling

The server-side metadata fetch does not handle API errors or exceptions from getV1GetSpecificGraph; consider try/catch to prevent build-time or runtime errors during metadata generation and fall back to a default title.

const { data: graph } = await getV1GetSpecificGraph(flowID, {
  version: parseInt(flowVersion),
});

if (!graph || typeof graph !== "object" || !("name" in graph)) {
  return {
    title: `Builder - AutoGPT Platform`,
  };
}

return {
  title: `${graph.name} - Builder - AutoGPT Platform`,
};
Param Validation

searchParams.flowVersion is parsed with parseInt without validating it’s a finite number; invalid input (e.g., non-numeric) could pass as NaN. Validate and fallback to default title when parsing fails.

const { data: graph } = await getV1GetSpecificGraph(flowID, {
  version: parseInt(flowVersion),
});
Title Side Effects

The previous client-side document.title effect was removed; confirm no other parts still depend on it and that SSR metadata fully covers all builder flows including the legacy editor.

const runnerUIRef = useRef<RunnerUIWrapperRef>(null);

const { toast } = useToast();

// It stores the dimension of all nodes with position as well
const [nodeDimensions, setNodeDimensions] = useState<NodeDimension>({});

const graphHasWebhookNodes = useMemo(
  () =>
    nodes.some((n) =>

Copy link

coderabbitai bot commented Oct 6, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch abhimanyuyadav/open-2725-fix-builder-page-title

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

netlify bot commented Oct 6, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit c8b5032
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/68e35016106adf0008180564

Copy link

netlify bot commented Oct 6, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit c8b5032
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/68e350169ce37d00088daebd

… flowID and flowVersion

- Updated the `generateMetadata` function in `page.tsx` to await the `searchParams` promise, ensuring correct extraction of `flowID` and `flowVersion`.
- This change improves the reliability of metadata generation for the BuilderPage component.
@Abhi1992002 Abhi1992002 requested a review from 0ubbe October 6, 2025 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🆕 Needs initial review
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant