Skip to content

Conversation

@eliandoran
Copy link
Contributor

@eliandoran eliandoran commented Sep 20, 2025

Closes #2382.

@eliandoran
Copy link
Contributor Author

/gemini review

@eliandoran eliandoran requested a review from Copilot November 9, 2025 13:02
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is a massive and very well-executed refactoring of the widget system to React. The new architecture is much cleaner, more modern, and more maintainable. The use of custom hooks to abstract complex logic is particularly well done. I've found a few issues, including a critical bug in one of the new utility functions, and some leftover debug statements. Once these are addressed, this will be an excellent contribution.

}, [ note ]);

useTriliumEvent("executeWithContentElement", async ({ resolve, ntxId: eventNtxId}) => {
console.log("Got request for content ", ntxId, eventNtxId);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This console.log statement appears to be for debugging and should be removed.

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 pull request represents a major refactoring effort to migrate type widgets from a legacy class-based architecture to a modern React/Preact component-based architecture. The changes include:

  • Migration of type widgets (text, code, canvas, relation map, etc.) from class-based TypeWidget implementations to functional React components
  • Reorganization of code into more modular structures with separation of concerns
  • Introduction of new TypeScript interfaces and improved type safety
  • Updates to dependencies and removal of transitive peer dependencies
  • Code cleanup including removal of console.log statements and trailing whitespace

Reviewed Changes

Copilot reviewed 148 out of 156 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updates to package dependencies, moving transitive peer dependencies
packages/commons/src/lib/server_api.ts Adds new API response interfaces for attachment conversion, relation maps, and note maps
packages/commons/src/lib/attribute_names.ts Reorganizes label types, moving note-type specific labels to a separate section
packages/ckeditor5/src/index.ts Exports additional WatchdogState type
apps/server/src/routes/assets.ts Adds Excalidraw asset serving for development mode
apps/server/src/routes/api/relation-map.ts Refactors to use shared type definitions from commons package
apps/server/src/routes/api/attachments.ts Adds type annotation using satisfies operator
apps/client/src/widgets/type_widgets/text/* New React-based text editor implementation with mobile toolbar support
apps/client/src/widgets/type_widgets/code/* New React-based code editor components
apps/client/src/widgets/type_widgets/canvas/* Refactored canvas widget into React components with separated persistence logic
apps/client/src/widgets/type_widgets/relation_map/* Complete rewrite of relation map as React components
apps/client/src/widgets/type_widgets/helpers/* New split editor components for SVG and general split views
apps/client/src/widgets/type_widgets/options/* Code cleanup and import path corrections
apps/client/src/widgets/type_widgets/type_widget.ts Simplified to interface definition for type widget props
Various deleted .ts files Legacy class-based type widget implementations removed
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

apps/client/src/widgets/react/NoteLink.tsx:62

  • Avoid automated semicolon insertion (92% of all statements in the enclosing function have an explicit semicolon).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


<EditableTextTouchBar watchdogRef={watchdogRef} refreshTouchBarRef={refreshTouchBarRef} />
</>
)
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

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

Avoid automated semicolon insertion (95% of all statements in the enclosing function have an explicit semicolon).

Copilot uses AI. Check for mistakes.
@eliandoran eliandoran changed the title React/type widgets Port type widgets to React Nov 9, 2025
@eliandoran eliandoran marked this pull request as ready for review November 9, 2025 19:41
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Nov 9, 2025
@eliandoran eliandoran merged commit 0ccc350 into main Nov 9, 2025
11 checks passed
@eliandoran eliandoran deleted the react/type_widgets branch November 9, 2025 20:32
@eliandoran eliandoran added this to the v0.100.0 milestone Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(Feature request) Transition to React

2 participants