From 827ef64f9e77fc24550253b17f16f3da43ffd350 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Tue, 4 Oct 2022 13:07:44 +0300 Subject: [PATCH] fix-edito-types --- package.json | 2 +- src/utils/p2p.ts | 9 ++++----- yarn.lock | 12 +----------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index d53214db..b28bf295 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "remark-code-titles": "^0.1.2" }, "devDependencies": { - "@astrojs/markdown-remark": "^1.1.2", + "@astrojs/markdown-remark": "^1.1.3", "@astrojs/mdx": "^0.11.1", "@astrojs/node": "^1.0.1", "@astrojs/partytown": "^1.0.0", diff --git a/src/utils/p2p.ts b/src/utils/p2p.ts index 977dd361..fc030d25 100644 --- a/src/utils/p2p.ts +++ b/src/utils/p2p.ts @@ -2,11 +2,11 @@ import { uniqueNamesGenerator, adjectives, animals } from 'unique-names-generato import { Awareness } from 'y-protocols/awareness' import { WebrtcProvider } from 'y-webrtc' import * as Y from 'yjs' -import type { Reaction } from '../graphql/types.gen' +// import type { Reaction } from '../graphql/types.gen' -export const roomConnect = (room, keyname = 'reactions'): [Reaction[], WebrtcProvider] => { +export const roomConnect = (room, keyname = 'reactions'): [Y.XmlFragment, WebrtcProvider] => { const ydoc = new Y.Doc() - const yarray = ydoc.getArray(keyname) + const yxmlfrag = ydoc.getXmlFragment(keyname) // TODO: encode/decode payload to Reactions[] const webrtcOptions = { awareness: new Awareness(ydoc), filterBcConns: true, @@ -31,6 +31,5 @@ export const roomConnect = (room, keyname = 'reactions'): [Reaction[], WebrtcPro provider.awareness.setLocalStateField('user', { name: username }) - const data = yarray.toArray() as Reaction[] - return [data, provider] + return [yxmlfrag, provider] } diff --git a/yarn.lock b/yarn.lock index 162f528d..203d6e2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -68,7 +68,7 @@ vscode-languageserver-types "^3.17.1" vscode-uri "^3.0.3" -"@astrojs/markdown-remark@^1.1.2", "@astrojs/markdown-remark@^1.1.3": +"@astrojs/markdown-remark@^1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@astrojs/markdown-remark/-/markdown-remark-1.1.3.tgz#9fa985a532622043f0863c20f01c6ed01eca31e2" integrity sha512-6MDuQXbrp2fZBYBIqD+0jvSqYAukiMTte6oLNHiEYsLf3KIMlVAZj6dDgUJakgL7cQ4fmzWb0HUqzVpxAsasLw== @@ -2452,11 +2452,6 @@ "@motionone/dom" "^10.14.2" tslib "^2.3.1" -"@nanostores/i18n@^0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@nanostores/i18n/-/i18n-0.7.0.tgz#f35137041fe4fcd08feaa3ff4a1baa8d4356457d" - integrity sha512-Qi/YPmj4J6oFMmqH13YyH1QV+CWemg9Z/JDBZTaCYEpiVIG+yfWs22GsW+GbHQ3eNCp5RdQ+leYN5ZI1TFyDhw== - "@nanostores/persistent@^0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@nanostores/persistent/-/persistent-0.7.0.tgz#7c919cbf102770190ed55cea13401a77bfde741e" @@ -6087,11 +6082,6 @@ globrex@^0.1.2: resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== -google-translate-api-x@^10.4.1: - version "10.4.1" - resolved "https://registry.yarnpkg.com/google-translate-api-x/-/google-translate-api-x-10.4.1.tgz#286fc4f0a5c5155e53f8d1850b3a2659af2642e2" - integrity sha512-ZV6NEhh0Og4AyYobLQ+tqWMtJ7hk+cm07ecqM8knarewbey7prr3X/6vKqBPEC6XgakiHjQRgifNyEhchCoGWA== - graceful-fs@^4.1.5, graceful-fs@^4.2.4, graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"