Skip to content

Conversation

@leekelleher
Copy link
Member

@leekelleher leekelleher commented Dec 4, 2025

Description

Following on from PR #21068, I asked Claude to review the "input-tiptap.element.ts" file to see if there were any performance or optimization recommendations that could be made. It came up with...

  • Replace redundant Promise.all with sequential awaits to clarify the intentional execution order
  • Cache toolbar and statusbar emptiness checks to avoid .flat() calls on every render
  • Pre-compute extension styles during initialization instead of processing on every render

Test plan

  • Verify RTE toolbar renders correctly when configured
  • Verify RTE statusbar renders correctly when configured
  • Verify RTE without toolbar/statusbar still functions
  • Verify custom stylesheets are applied to RTE content

🤖 Generated with Claude Code

leekelleher and others added 3 commits December 4, 2025 17:00
The inner awaits in Promise.all([await ..., await ...]) made the operations
sequential anyway. Since #loadEditor() depends on _extensions being populated,
sequential execution is correct - this change makes the intent clearer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Instead of calling .flat() on every render to check if toolbar/statusbar
have items, compute the boolean once when values are set in #loadEditor().
This avoids unnecessary array operations during render cycles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Instead of calling unsafeCSS() on each style during every render cycle,
collect and process styles once in #loadEditor() and store the result
in _extensionStyles. This avoids repeated CSS processing during renders.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/packages/tiptap/components/input-tiptap/input-tiptap.element.ts
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 optimizes the Tiptap RTE component's initialization and rendering performance through three targeted improvements: simplifying the sequential extension loading pattern, caching toolbar/statusbar visibility checks to avoid repeated array operations, and pre-computing extension styles during initialization rather than on every render.

Key Changes:

  • Replaced redundant Promise.all wrapper with clear sequential awaits in firstUpdated()
  • Added cached #hasToolbar and #hasStatusbar flags to avoid .flat() operations on every render
  • Consolidated extension styles into a single CSSResultGroup computed once during initialization

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.

2 participants