Skip to content

Conversation

Wroud
Copy link
Member

@Wroud Wroud commented Sep 12, 2025

closes dbeaver/pro#6327
closes dbeaver/pro#5174
closes dbeaver/pro#4922

@Wroud Wroud self-assigned this Sep 12, 2025
markOutdated(): void;
}

export function useSync(callback: () => void | Promise<void>): ISyncHook {
Copy link
Member

Choose a reason for hiding this comment

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

The name of this hook is too generic. Could we give it a more explicit name so it’s clearer why we need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree; it's generic (and it's really generic), but I can't imagine another name. This hook aims to provide a simple way to implement a React-based reaction to side effects. Generally, we have imperative code that will invoke the function right away. This leads to problems when an event might be called multiple times, so we will have numerous functions running in concurrent mode.

That leads to problems like this one you fixed earlier: #3734

useSync "connects" events with React lifecycle, so the interface can react to changes in a React manner by utilizing React's built-in batching functionality.

sergeyteleshev
sergeyteleshev previously approved these changes Sep 16, 2025
devnaumov
devnaumov previously approved these changes Sep 16, 2025
@Wroud Wroud dismissed stale reviews from sergeyteleshev and devnaumov via c8ef08b September 16, 2025 14:50
sergeyteleshev
sergeyteleshev previously approved these changes Sep 16, 2025
devnaumov
devnaumov previously approved these changes Sep 16, 2025
@Wroud Wroud dismissed stale reviews from devnaumov and sergeyteleshev via 7854d52 September 17, 2025 10:02
devnaumov
devnaumov previously approved these changes Sep 17, 2025
devnaumov
devnaumov previously approved these changes Sep 17, 2025
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.

5 participants