Git Product home page Git Product logo

Comments (4)

jessegrosjean avatar jessegrosjean commented on August 28, 2024 1

Even with the naming of objectWillChange, I've never been terribly clear on what the timing requirements are far, and how those process in terms of the current runloop through synchronous calls.

Agreed. I don't really know either, and it's always been a weird looking call.

Right now it's the only way to subscribe for changes in Automerge, I think maybe that's the biggest problem. Really need a real event, instead of trying to bend this one to do what I want.

With that said I still think the current setup where you get an exception when trying to access the document (unless you debounce) doesn't seem right to me and I would think is sure to generate errors for others.

I don't immediately see anywhere that you are checking to see if there will be a change before calling objectWillChange. I guess my vote would be to move it outside of the sync block and see if MeetingNotes still behaves.

from automerge-swift.

heckj avatar heckj commented on August 28, 2024

Even with the naming of objectWillChange, I've never been terribly clear on what the timing requirements are far, and how those process in terms of the current runloop through synchronous calls. I've no qualms with generally calling this outside (prior) to the dispatchqueue sync protection lock, although I think I recall in some places I'm actually checking to see if there's any change to be made, and skipping calls to change if contents are identical, that might stymie some of this. But i'm saying that without coffee yet this morning and no code in front of me. ;-)

from automerge-swift.

heckj avatar heckj commented on August 28, 2024

Ah - found what I was thinking about - there's calls in Counter & AutomergeText objects (reference type overlays that dynamically read/write into Document as changes are made to them) that also expose ObservableObject, and it's in there that I'm doing the "post-change" checking - the vague-ish-workaround being that I wanted to know if any given 'objectWillChange' was the a relevant result for the part of the schema that the object tracks. The change signals from a document coming from any of: user interactions, calls to merge other docs, applying sync messages, or even encoded changes locally.

In those cases the "objectDidChange" is far more of how I coded it up - with the sole purpose behind those being "do I need to send a signal to UI frameworks to re-render the content", and not at all the "can I capture the state markers of the document" kind of thing. Anyway, shouldn't be an issue to muck with the Document calls directly and move them outside of the DispatchQueue.sync

from automerge-swift.

heckj avatar heckj commented on August 28, 2024

@jessegrosjean Take a look over #179 - I've added a test that mostly is verifying that the specific thing we're after (capturing heads prior to a change) is, in fact, possible (test crashed prior to the code changes, as expected with attempting synchronous access to Document).

from automerge-swift.

Related Issues (20)

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.