Giter Club home page Giter Club logo

y-map's People

Contributors

dmonad avatar istvank avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

istvank calibr druuu

y-map's Issues

.keys() shows non-existent keys after reload

When using websockets, after a reconnect the deleted nodes are still shown as entries when calling .keys().

Reproduce:

  1. Create several entries (custom types).
  2. Remove them
  3. Reload
  4. Entries still exist

Solution: Probably just check if ops are deleted before putting them in .opContents/.contents.

Support deleting multiple keys

Hi all,
Can we apply multiple deletions in one operation ?
If I understand the library right, when we make want to make a change, we broadcast this change to other peers and they will resolve the conflicts. If we can support this, we can send multiple ops in one message, this will give better performance.
Thanks.

How to Delete a key locally?

When using IPFS I want to unsubscribe the topic and .delete(key) locally. Not delete the key across the network.

How do I Achieve this?

get promise returns undefined

In my y-map array observer, let's call it observeMap(event), when calling event.object.get(event.name).then(function(map)) {...}, the value of map is undefined in the newest release. ๐Ÿ˜ข

Observation Order Reversed when Set Offline

Data set by User 1 whilst connected to YJS is received by User 2 in order of being set, whereas data set whilst User 1 isn't connected, then a connection is re-established is received by User 2 in reverse order

User 2 Observation when User 1 sets whilst connected
ordered map

User 2 Observation when User 1 sets whilst offline, then reconnects
unordered

Means to serialize or synchronize JSON data with y-map

I'm looking to keep a JSON array synchronized across clients using YJS and y-map fits the bill. However, in my application I would would prefer to keep the array type which the client directly manipulates and reads from as JSON since it is easier to plug in to other libraries.

From my understanding currently there is no way to 'synchronize' the y-map with a JSON array, is that correct? If so would something that does that be in the scope of this data type (i.e. a serialize/deserialize) or would a separate library be a better place?

Detailed Error Info on Promises

When getting a store that doesn't exist, the promise throws a console error.
Being told why the error occurred may be useful as it will help with scenarios such as if doesn't exist, create.

event.value is undefined when you add a type to a YMap

The event fired when you add a new key to a YMap has a value key when you add a primitive value, but has undefined value when you add a Y type. Here are two tests to illustrate. The first one passes and the second one fails. I'm not sure what the intended behaviour is, but maybe this is an issue which is easily fixed (In the event handler, I just do event.value = event.object.get(event.name).

There's also a similar issue in YArray.toArray() where Y primitives appear as expected, but Y types show as undefined.

      it('event has correct value when setting a primitive on a YMap', async(function * (done) {
        var event
        yield flushAll()
        y1.observe(function (e) {
          event = e // just put it on event, should be thrown synchronously anyway
        })
        yield y1.set('stuff', 2)
        expect(event.value).toEqual(event.object.get(event.name))
        // delete
        y1.delete('stuff')
        done()
      }))
      it('event has correct value when setting a type on a YMap', async(function * (done) {
        var event
        yield flushAll()
        y1.observe(function (e) {
          event = e // just put it on event, should be thrown synchronously anyway
        })
        yield y1.set('stuff', Y.Map)
        expect(event.value).toEqual(event.object.get(event.name))
        // delete
        y1.delete('stuff')
        done()
      }))

Document observer event

Hey, thanks for the great work! However, I cannot find in your documentation how the event looks like that the observer gets. E.g., it was hard work to figure out that I can get the value by event.object.get(event.name, ...). And after implementing it like this, I found it out the hard way that it also works with event.value. ๐Ÿ’ƒ

dynamically set a nested property?

First off, thanks for making and maintaining this project, it seems great!

Given the following:

const Y = require('yjs')
newDoc = new Y.Doc()

doc = newDoc.getMap('patches') 

doc.set('patch', 
  {"people": 
    {"michael": 
      { "lastname": "smith",
        "height": "tall"
      },
    "sal": 
      { "lastname": "orange",
        "height": "small"
      }
    }
  })

In vanilla js, to dynamically update a property I could do:

let name = 'sal'
let prop = 'height'
people[name][height] = 'short'

How would I do this same operation in Yjs? I know that issue #11is similar, but does not discuss dealing with nested and dynamic properties.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.