Skip to content

[WIKI-345] regression: update block menu options#7647

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
chore-update_block_menu
Aug 26, 2025
Merged

[WIKI-345] regression: update block menu options#7647
sriramveeraghanta merged 2 commits intopreviewfrom
chore-update_block_menu

Conversation

@iam-vipin
Copy link
Member

@iam-vipin iam-vipin commented Aug 26, 2025

Description

this pr update the requirement of flaggedExtensions and disabledExtensions for block menu

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • Refactor

    • Hardened editor configuration by requiring flagged and disabled extension settings, reducing edge cases during rendering.
    • Added groundwork for embed handling within core extension configuration (no behavioral change yet), paving the way for richer embeds.
  • Chores

    • Minor prop ordering cleanup in the document editor; no user-visible impact.
    • General typing and contract improvements to enhance stability and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds embedHandler to core extension props type. Makes PageRenderer require flaggedExtensions and disabledExtensions. Adjusts Document editor to pass props accordingly (order change only). No runtime logic changes.

Changes

Cohort / File(s) Summary
Core extension props type
packages/editor/src/ce/extensions/core/extensions.ts
Expanded TCoreAdditionalExtensionsProps to include embedHandler via Pick<IEditorProps, ...>. No runtime behavior change in CoreEditorAdditionalExtensions implementation.
Document editor and renderer
packages/editor/src/core/components/editors/document/editor.tsx, packages/editor/src/core/components/editors/document/page-renderer.tsx
PageRenderer props updated to require flaggedExtensions and disabledExtensions. Editor updated to pass these explicitly; reordered isTouchDevice argument without behavior change.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

🌐frontend, 🛠️refactor

Suggested reviewers

  • Palanikannan1437

Poem

In burrows of code I twitch my nose,
New props hop in where the PageRenderer goes.
An embedHandler nibble, two flags in a row—
No logic carrots moved, just tidier flow.
Thump-thump approval from a tidy-toed doe. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore-update_block_menu

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@iam-vipin iam-vipin changed the title Chore update block menu chore: update block menu options Aug 26, 2025
@iam-vipin iam-vipin requested a review from aaryan610 August 26, 2025 08:00
@iam-vipin iam-vipin changed the title chore: update block menu options [WIKI-345] regression: update block menu options Aug 26, 2025
@iam-vipin iam-vipin marked this pull request as ready for review August 26, 2025 08:03
Copilot AI review requested due to automatic review settings August 26, 2025 08:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a regression in the block menu functionality by making the flaggedExtensions and disabledExtensions props required instead of optional. The changes ensure that these props are properly passed to the BlockMenu component.

  • Updated prop types to make flaggedExtensions and disabledExtensions required in PageRenderer
  • Reordered props in DocumentEditor component call
  • Added embedHandler to the core extensions type definition

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
page-renderer.tsx Makes flaggedExtensions and disabledExtensions required props for PageRenderer
editor.tsx Reorders props in PageRenderer call (flaggedExtensions and disabledExtensions before isTouchDevice)
extensions.ts Adds embedHandler to TCoreAdditionalExtensionsProps type definition

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
packages/editor/src/ce/extensions/core/extensions.ts (2)

10-13: Remove empty destructuring to appease linters and reduce noise.

const {} = props; can trigger eslint’s no-empty-pattern and adds noise. It’s safe to drop.

 export const CoreEditorAdditionalExtensions = (props: TCoreAdditionalExtensionsProps): Extensions => {
-  const {} = props;
   return [];
 };

5-8: Unify embedHandler/embedConfig naming

It looks like you’ve successfully surfaced embedHandler in the core props, but the document extensions API still uses embedConfig. This dual naming shows up in several places and could lead to confusion down the road. Consider renaming one to match the other across the codebase:

• packages/editor/src/ce/extensions/document-extensions.tsx:
embedConfig: TEmbedConfig | undefined
• packages/editor/src/core/hooks/use-collaborative-editor.ts:
DocumentEditorAdditionalExtensions({ …, embedConfig: embedHandler, … })
• packages/editor/src/core/components/editors/document/editor.tsx:
DocumentEditorAdditionalExtensions({ …, embedConfig: embedHandler, … })

You might either:

  • Rename all embedConfig parameters to embedHandler in the DocumentEditorAdditionalExtensions API
  • Or switch the core prop back to embedConfig for full alignment

Either approach will reduce cognitive load and prevent mix-ups in future refactors.

packages/editor/src/core/components/editors/document/editor.tsx (2)

40-69: useMemo has an empty dependency array but derives from props; consider adding deps or document “init-only” intent.

The extensions array depends on several props (embedHandler, disabledExtensions, flaggedExtensions, editable, fileHandler, user). With [], updates to those won’t recompute extensions, which could lead to stale behavior if parent props change post-mount. If intentional (init-only), add a brief comment. Otherwise, add dependencies.

-  const extensions: Extensions = useMemo(() => {
+  const extensions: Extensions = useMemo(() => {
     const additionalExtensions: Extensions = [];
     if (embedHandler?.issue) {
       additionalExtensions.push(
         WorkItemEmbedExtension({
           widgetCallback: embedHandler.issue.widgetCallback,
         })
       );
     }
     additionalExtensions.push(
       SideMenuExtension({
-        aiEnabled: !disabledExtensions?.includes("ai"),
+        aiEnabled: !disabledExtensions?.includes("ai"),
       }),
       HeadingListExtension,
       ...DocumentEditorAdditionalExtensions({
         disabledExtensions,
-        embedConfig: embedHandler,
+        embedConfig: embedHandler,
         flaggedExtensions,
         isEditable: editable,
         fileHandler,
         userDetails: user ?? {
           id: "",
           name: "",
           color: "",
         },
       })
     );
     return additionalExtensions;
-  }, []);
+  }, [embedHandler, disabledExtensions, flaggedExtensions, editable, fileHandler, user?.id, user?.name, user?.color]);

If the intent is “construct once,” add:

// Intentional: build extensions once on mount.

49-67: Minor naming mismatch: embedConfig vs embedHandler.

Here we pass embedConfig: embedHandler. This works, but the dual terminology across modules is confusing. Consider standardizing on “embedHandler” throughout (or “embedConfig” if that’s the chosen term) in a follow-up to improve coherence.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0fe7da6 and a674b69.

📒 Files selected for processing (3)
  • packages/editor/src/ce/extensions/core/extensions.ts (1 hunks)
  • packages/editor/src/core/components/editors/document/editor.tsx (1 hunks)
  • packages/editor/src/core/components/editors/document/page-renderer.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/editor/src/core/components/editors/document/page-renderer.tsx (1)
packages/editor/src/core/types/editor.ts (1)
  • IEditorProps (133-160)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (1)
packages/editor/src/core/components/editors/document/editor.tsx (1)

103-104: Boolean cast for isTouchDevice is fine.

The double-bang ensures a strict boolean; no issues here.

@sriramveeraghanta sriramveeraghanta merged commit cf7b288 into preview Aug 26, 2025
9 of 11 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-update_block_menu branch August 26, 2025 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants