-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
fix: byo hocuspocus provider does not work #3834
base: main
Are you sure you want to change the base?
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: 079b13f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Sorry I don't have perms to see what is wrong with the vercel build |
Including our patch used with diff --git a/dist/react/index.mjs b/dist/react/index.mjs
index a4705afd2b8aecba9d47c6b5c33ddc70de635686..9ea882c4de9d8f3580a9825cdba8d78fb3a8dc09 100644
--- a/dist/react/index.mjs
+++ b/dist/react/index.mjs
@@ -87,11 +87,33 @@ var BaseYjsPlugin = createTSlatePlugin({
provider: {}
}
}).extend(({ getOptions, setOption }) => {
- const { hocuspocusProviderOptions } = getOptions();
+ const { hocuspocusProviderOptions, provider } = getOptions();
+ if(provider) {
+ provider.setConfiguration({
+ onAwarenessChange() {},
+ onConnect() {
+ setOption("isConnected", true);
+ provider.onConnect();
+ },
+ onDisconnect(data) {
+ setOption("isConnected", false);
+ setOption("isSynced", false);
+ provider.onDisconnect(data);
+ },
+ onSynced(data) {
+ setOption("isSynced", true);
+ provider.onSynced(data);
+ }
+
+ })
+ return {
+ options: { provider }
+ }
+ }
if (!hocuspocusProviderOptions) {
throw new Error("HocuspocusProvider configuration is required");
}
- const provider = new HocuspocusProvider(__spreadProps(__spreadValues({}, hocuspocusProviderOptions), {
+ const defaultProvider = new HocuspocusProvider(__spreadProps(__spreadValues({}, hocuspocusProviderOptions), {
onAwarenessChange() {
},
onConnect() {
@@ -112,7 +134,7 @@ var BaseYjsPlugin = createTSlatePlugin({
}
}));
return {
- options: { provider }
+ options: { provider:defaultProvider }
};
}); |
Checklist
yarn typecheck
<-- failing on unrelated changesyarn lint:fix
yarn test
yarn brl
yarn changeset
Options allow a byo yjs provider, but it is overwritten during plugin config.
This allows us to provide our own hocuspocus provider, but wraps any relevant hooks so that it doesn't break existing plate expectations around state management.