GithubHelp home page GithubHelp logo

Comments (14)

tute avatar tute commented on June 2, 2024

I'm using blocking connectors.

With the non-inverse workaround I had trouble creating child objects, so I brought it back. According to the README it should anyway be always there, so that Orbit takes care of relations.

But now I get the same error on delete and on create: can do it only once. Then, it doesn't work any longer. Reload and the same. Clear localStorage and reload, and can create or delete one more time again. I'm lost and fearful of state. :)

from ember-orbit.

tute avatar tute commented on June 2, 2024

Last attempt of sharing debugging info for today: I many times get to the error logged in https://github.com/orbitjs/ember-orbit/blob/master/lib/ember-orbit/record-array-manager.js#L77 (something like !!!! unhandled change 5 ["farm", "21c904de-f3dd-47df-ad1b-ea3981545ccb", "__rel", "plots", "3a18d0e5-b9f7-31d5-288f-151493e303e3"], value: true, for replace op).

And as a workaround to not send __rel updates to the server I did the following commit, which I'm somewhat ashamed to share, but hopefully we both come to a nice solution: tute/orbit.js@a4b1147

from ember-orbit.

tute avatar tute commented on June 2, 2024

Just saw https://github.com/orbitjs/orbit.js/blob/master/test/tests/orbit_common/unit/memory-source-test.js#L55-L173 (TODO - fixup transform tests). Related maybe?

from ember-orbit.

dgeb avatar dgeb commented on June 2, 2024

@tute I'm sorry for the trouble you're having. I'm going to review orbitjs/orbit#43 very soon, then review JSON API compliance in general, and then will help you resolve any problems that remain on your end.

from ember-orbit.

pixelhandler avatar pixelhandler commented on June 2, 2024

@tute do you have a code example that you can share that shows how you connected the memory and JSONAPI sources?

I found this, #15 (comment) perhaps I can use this example as a template for connecting memory and JSONAPI sources.

from ember-orbit.

tute avatar tute commented on June 2, 2024

@pixelhandler it's this sample: #15 (comment). With the addition of non-blocking "two-way" connector between localStorage and JSON API.

For now I'm working with memory-localStorage, and now working in syncing "by hand" the localStorage JSON payload with the server in a custom action, until we have a compliant adapter. It was surprisingly hard to track where the promises fail.

from ember-orbit.

pixelhandler avatar pixelhandler commented on June 2, 2024

@tute thanks for the example, I was able to connect memory and JSONAPI sources like so, https://github.com/pixelhandler/blog/blob/try-ember-orbit-with-ember-cli/client/app/initializers/ember-orbit.js I'll try out adding a relationship next.

from ember-orbit.

tute avatar tute commented on June 2, 2024

@dgeb I just found this error is not specific for JSON API. Connecting only memory to localStorage, non blocking, and the two models together with their inverses, upon deletion I get the dreaded failed Promise, that I still can't track down on why it does fail. Stack Trace from Ember inspector in Chrome:

at new Promise
at Evented.interface.resolve
at Requestable.defineAction.object.(anonymous function) [as removeLink]
at Source.extend.removeLink
at RecordArray.extend.arrayContentWillChange
at apply
at superWrapper [as arrayContentWillChange]
at EmberObject.extend.arrangedContentArrayWillChange
at applyStr

path is:

path: Array[5]
0: "farm"
1: "ca6a9ed9-d05c-4e95-af70-38e410b5d9f7"
2: "__rel"
3: "plots"
4: "eed7a78b-53dc-4e01-993d-75e623e45121"

from ember-orbit.

tute avatar tute commented on June 2, 2024

Workaround (at last one that allows me to continue performing operations and seemingly works well): Pass an empty array instead of ops in _removeLinks: https://github.com/orbitjs/orbit.js/blob/master/lib/orbit-common/source.js#L193, effectively ignoring removal of links.

from ember-orbit.

dgeb avatar dgeb commented on June 2, 2024

@tute I need to write a failing test, but I'm curious whether your problem is solved by commenting out the following lines instead: https://github.com/orbitjs/orbit.js/blob/master/lib/orbit-common/source.js#L181-191

from ember-orbit.

tute avatar tute commented on June 2, 2024

I tried that, it didn't change the behavior. If it helps, given I probably can't specify the issue in enough detail, I can record a video for you of the failure, or can give you access to the running app in development.

from ember-orbit.

pixelhandler avatar pixelhandler commented on June 2, 2024

@dgeb @tute I was not able to use relationships for my test (blog) app. I setup Post and Author models (post hasOne author and author hasMany posts). But, the post didn't load the related author using the links property for the author by id. I had errors about path not found. I noticed commented out tests for EO.hasOne so figured that relation may still be a TODO.

from ember-orbit.

dgeb avatar dgeb commented on June 2, 2024

@tute @pixelhandler I've recently made quite a few updates to relationships, both in orbit and ember-orbit. Management of inverse relationships is now done in each source's transform method, since some sources will want to let the backend handle them. Furthermore, relationships can now be set on object creation.

Please give the latest versions of orbit (0.5.2) and ember-orbit (0.4.0) a try and reopen this or another issue if you're still having trouble with relationships. Thanks!

from ember-orbit.

pixelhandler avatar pixelhandler commented on June 2, 2024

@dgeb thanks for pinging me it's about time I update my Orbit.js and ember-orbit versions, thanks!

from ember-orbit.

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.