# Library issue: yJs synchronisation and client (state) being overwritten

**URL:** <https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681>\
**Category:** Help\
**Created:** [June 11, 2022, 4:03pm UTC](https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681 "2022-06-11T16:03:16Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![dleeftink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/dleeftink/32/7049_2.png) [@dleeftink](https://talk.observablehq.com/u/dleeftink)\
**Post date:** [June 15, 2022, 2:02pm UTC](https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681/21 "2022-06-15T14:02:39Z")

</div>

I’ve since added a `peer view` and found a suitable iceServer / TURN configuration working for cellular connections (at least, in the EU). If anyone still is running into issues, let me know.

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [June 15, 2022, 2:27pm UTC](https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681/22 "2022-06-15T14:27:02Z")

</div>

@dleeftink My original suggestion contained

```javascript
const peers = () => provider.room.webrtcConns.size

```

simply as a shorthand getter. There is no point in declaring it async, and you can just reference the map directly:

```javascript
const peers = provider.room.webrtcConns;

```

---

<div class="post-metadata">

**Author:** ![dleeftink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/dleeftink/32/7049_2.png) [@dleeftink](https://talk.observablehq.com/u/dleeftink)\
**Post date:** [June 15, 2022, 2:34pm UTC](https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681/23 "2022-06-15T14:34:06Z")

</div>

Woops this was added pre custom server config to listen to ydoc changes but forgot to take it out. Thanks for all suggestions and reviewing:)

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [August 27, 2022, 10:04am UTC](https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681/24 "2022-08-27T10:04:01Z")

</div>

There is a much easier way to resolve the conflict, using [esm.sh](https://github.com/ije/esm.sh):

```javascript
Y = import('https://esm.sh/yjs@13.5.41')

```

```javascript
WebrtcProvider = (await import('https://esm.sh/y-webrtc@10.2.3?deps=yjs@13.5.41')).WebrtcProvider

```

[Previous page](https://talk.observablehq.com/t/library-issue-yjs-synchronisation-and-client-state-being-overwritten/6681.md?page=1)
