-
-
Notifications
You must be signed in to change notification settings - Fork 765
docs: migrate demo to yhub collaboration on stable yjs 13 #2987
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
Merged
+16
−7
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 34568
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 15230
🌐 Web query:
y-websocket 2.1.0 WebsocketProvider constructor connect default destroy source💡 Result:
In y-websocket 2.1.0, the WebsocketProvider is initialized using the following constructor signature: new WebsocketProvider(serverUrl: string, room: string, ydoc: Y.Doc [, wsOpts: WsOpts]) [1][2][3] Key details regarding the requested methods and defaults include: Connect and Initialization By default, the WebsocketProvider attempts to establish a connection immediately upon instantiation [1][2][3]. This behavior is controlled by the connect property within the optional wsOpts configuration object [1][2]. - wsOpts.connect: Defaults to true. If set to false, the provider will not connect automatically, and you must manually call wsProvider.connect to establish the websocket connection [1][2][4]. - wsProvider.connect: This method can be called at any time to establish or re-establish a connection to the websocket server [5][4][6]. Destroying the Provider - wsProvider.destroy: This method is used to permanently shut down the provider instance [1][2][4]. Calling it disconnects from the server, removes all event listeners, and stops any further reconnection attempts [1][2][5][4]. Additional wsOpts Configuration Beyond the connect flag, the wsOpts object allows customization of several other parameters, including [1][2][3]: - params: An object of key-value pairs that are URL-encoded and appended to the serverUrl (e.g.,?auth=bearer) [1][3][4]. - WebSocketPolyfill: Allows providing a custom WebSocket implementation (e.g., the 'ws' package in Node.js environments) [1][2][4]. - awareness: Specifies an existing Awareness instance from y-protocols [1][2][3]. - maxBackoffTime: Sets the maximum interval (in milliseconds) between reconnection attempts during exponential backoff (defaults to 2500ms) [1][2][5].
Citations:
🌐 Web query:
React 19 Strict Mode useMemo calculation called twice initial mount effect setup cleanup reused memoized value💡 Result:
In React 19, Strict Mode continues to assist in identifying impure code and side-effect issues during development by intentionally performing double-invocations [1][2]. However, there is a specific change regarding how hooks like useMemo and useCallback behave during these development-only double-renders [3][4][5]. Memoized value handling in React 19 Strict Mode: Unlike in previous versions, where the calculation function passed to useMemo would run twice during the initial mount, React 19 now reuses the memoized result from the first render during the second render [3][4][5]. This change ensures that components which are already Strict Mode compatible do not experience different behavior, while still maintaining the goal of surfacing impure code through other mechanisms [4]. Effect setup and cleanup: Strict Mode's fundamental behavior of remounting components remains unchanged [2]. In development, when a component mounts, React immediately unmounts it and then remounts it [2]. This process causes: 1. The effect setup to run. 2. The effect cleanup to run. 3. The effect setup to run again [2]. This pattern is designed to reveal issues where cleanup functions are missing or incomplete, ensuring that effects are resilient and production-ready [2]. If an effect lacks a proper cleanup function, the double-invocation can lead to bugs, such as orphaned event listeners or duplicate external connections, which helps developers identify and fix these issues early [2]. In summary, while the memoization logic for useMemo and useCallback has been optimized to reuse values across the double-render pass in React 19 [3][4], the effect mount-unmount-remount cycle remains a core mechanism of Strict Mode to proactively surface side-effect bugs [2].
Citations:
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 316
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 6058
🌐 Web query:
site:react.dev/reference/react/StrictMode useMemo effect cleanup re-render development React 19💡 Result:
In React 19, as in previous versions, useMemo does not have a cleanup function, nor is one expected [1][2]. The purpose of useMemo is to cache the result of a calculation during rendering; therefore, the function passed to it must be pure [1][3]. If you are observing unexpected re-renders or behavior related to useMemo, it is likely due to React's Strict Mode in development [1][2]. When Strict Mode is enabled, React intentionally runs your component's rendering logic—including functions passed to useMemo, useState, and useReducer—twice [1][4]. This double-invocation is a development-only feature designed to help you detect impure code and side effects in your rendering logic [1][2]. Key takeaways regarding this behavior: - Development vs. Production: This double-rendering behavior is strictly limited to development builds [2]. It does not occur in production and has no impact on your production application's performance or behavior [2]. - Purity Requirement: Because React may invoke your useMemo function multiple times, you must ensure it remains pure and does not perform side effects [1][3]. - Effect Cleanup vs. useMemo: If you need to perform side effects that require cleanup (such as subscriptions or manual DOM manipulations), you should use useEffect, which explicitly supports a cleanup function [1][3]. If you find that your useMemo calculation is running unexpectedly often, verify that its dependencies are stable and that you are not performing impure operations within the memoized function [1][2].
Citations:
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 12824
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 5874
Move
WebsocketProviderconstruction out of render.new WebsocketProvider(...)runs inuseMemo, andy-websocketconnects by default. The docs app enablesreactStrictMode. React 19 invokes theuseMemocalculation twice and replays the Effect. The cleanup destroys the memoized provider, then the replay reuses that destroyed provider. The other provider remains connected without cleanup.destroy()disconnects the provider and removes its Yjs handlers.Create the
Y.Docand provider in an Effect-owned lifecycle. Render the editor only after the pair exists. Destroy the same pair in that Effect cleanup. Add a Strict Mode mount test.🤖 Prompt for AI Agents
Source: MCP tools