Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[front] - chore(InputBar): url pasting formatting #11425

Merged
merged 9 commits into from
Mar 19, 2025

Conversation

JulesBelveze
Copy link
Contributor

@JulesBelveze JulesBelveze commented Mar 18, 2025

Description

This PR fix React state update conflicts in URL paste handling.

Problem:
When pasting URLs, editor commands triggered synchronous state updates during React's render phase. This caused "flushSync" warnings and potential race conditions

Solution:

  • Defer editor commands to next event loop tick using setTimeout
  • Create atomic content array to handle replacement in one transaction

Screenshot 2025-03-19 at 09 48 44

Risk

Low

Deploy Plan

  • Deploy front-edge
  • Deploy front

…ource link components for the editor

 - Added 'DataSourceLinkComponent' to render data source links with icons in the input bar editor
 - Implemented 'DataSourceLinkExtension' for tiptap editor, enabling inline data source linking within text editor
…urceLinkExtension into custom editor

 - Added DataSourceLinkExtension to the list of extensions in useCustomEditor to handle data source links
 - Simplified useUrlHandler hook to directly insert dataSourceLink nodes upon selection of a node
 - Simplified the markup of DataSourceLinkComponent for clarity
 - Adjusted Chip component usage with icon and smaller size "xs"
 - Ensure compatibility with the latest features and bug fixes in the @dust-tt/sparkle library
 - Maintain integrity and stable functionality within the project dependencies
…itor hook

 - Remove duplicate DataSourceLinkExtension import in useCustomEditor.tsx
 - Add a missing dependency to useEffect in OAuth finalize page

[front/components] - style: add whitespace for better readability in extensions

 - Insert a blank line for visual separation in DataSourceLinkExtension.ts and useUrlHandler.tsx
…ip text is readable

 - Added `color="white"` to `Chip` component to improve text visibility against varying backgrounds
…dling in editor

 - Simplify the logic for inserting dataSourceLink by using a chain of editor commands
 - Ensure correct spacing around inserted dataSourceLink by checking for leading space requirements and adjusting the insertion accordingly
 - Clean up the pending URL from the storage once the dataSourceLink is inserted
@JulesBelveze JulesBelveze marked this pull request as draft March 18, 2025 08:58
…: improve URL handling in input editor

 - Implemented `replaceUrl` callable function to handle editor command execution with deferring and content formatting
 - Introduced a cleaner approach to checking the necessity for leading spaces before inserting content
 - Adjusted useEffect dependency array to ensure proper cleanup and avoid potential duplicates in URL handling
@JulesBelveze JulesBelveze marked this pull request as ready for review March 19, 2025 08:56
Copy link
Contributor

@philipperolet philipperolet left a comment

Choose a reason for hiding this comment

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

Looks reasonable 😉

@JulesBelveze JulesBelveze merged commit bb9c7a5 into main Mar 19, 2025
13 checks passed
@JulesBelveze JulesBelveze deleted the front/url-pasting-formatting branch March 19, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants