Giter VIP home page Giter VIP logo

Comments (13)

jonnii avatar jonnii commented on July 29, 2024

I think this is because the model hook is only called if the route is entered from the url, if not the model should be known (because it's passed to the linkTo). I think something like this is better done in activate.

from epf.

heartsentwined avatar heartsentwined commented on July 29, 2024

Thanks for the activate idea. Clarification on the model hook:

  • if it is a non-dynamic route (i.e. no :foo_id segments), then it is always called
  • if it is a dynamic route, then it is only called on url entry; otherwise a model instance would be expected (from transitionTo, replaceWith, or the linkTo helper)

In this case though, the route in question is a non-dynamic route, so using the model hook should not be the cause.

from epf.

ghempton avatar ghempton commented on July 29, 2024

@heartsentwined I think you are correct about the behavior of the model hook. Is the model hook actually hit here?

Eventually I would like to document a solid set of example CRUD routes.

from epf.

heartsentwined avatar heartsentwined commented on July 29, 2024

I dropped console.log() statements in there, and have already checked that they are hit / not hit as described above.

from epf.

ghempton avatar ghempton commented on July 29, 2024

What exactly are the symptoms of flush not being called? I assume that the line of code is being hit but nothing is sent to the server? What happens if you create the model and manually set inside setupController? Also, if you have time to set up a fiddle for this I will debug this deeper.

from epf.

heartsentwined avatar heartsentwined commented on July 29, 2024

You're right, nothing is sent to the server. The flush is being called, and got resolved immediately. The above is a minimal illustration, a slightly longer example will be

# inside save event
@context.session.flush -> console.log 'done'
# make server sleep, say, 2 secs, on any request

Now flush() does get called, and on the "successful" case described above, I see the server request in the console, and that done went back after 2 secs. On the "failure" case, no server request in the console, and done went back immediately. Quick and dirty testing, I admit.

The fiddle - sorry, I have no experience in making ember fiddles, and I have no idea how to illustrate this with one.

from epf.

ghempton avatar ghempton commented on July 29, 2024

Hmm sounds like for whatever reason the session is not seeing the newly created model as being dirty, or if it is, it could be being blocked by another operation on a different related model. Can you share more code (e.g. model definition)? Are there any other models being updated/created before you transition to this route?

from epf.

heartsentwined avatar heartsentwined commented on July 29, 2024

I'm fairly sure that's all useful code, nevertheless,

class App.Foo extends Ep.Model
  desc: Ep.attr 'string' # or whatever, just a dummy field

This has been isolated, there is no other model.

from epf.

ghempton avatar ghempton commented on July 29, 2024

Sorry, this one fell off the radar for me. Still stuck in the same place?

from epf.

rayb avatar rayb commented on July 29, 2024

I will let you know shortly – thanks!

From: Gordon L. Hempton [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:43 PM
To: GroupTalent/epf
Subject: Re: [epf] session.create() issue / example (#10)

Sorry, this one fell off the radar for me. Still stuck in the same place?


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-21150783.

from epf.

rayb avatar rayb commented on July 29, 2024

You can close this bug. I don’t know what we did wrong before but it is no longer an issue.

Thanks

Ray

From: Gordon L. Hempton [mailto:[email protected]]
Sent: Wednesday, July 17, 2013 3:43 PM
To: GroupTalent/epf
Subject: Re: [epf] session.create() issue / example (#10)

Sorry, this one fell off the radar for me. Still stuck in the same place?


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-21150783.

from epf.

heartsentwined avatar heartsentwined commented on July 29, 2024

I've been working on other code since this was reported; I'll get back on this when I'm back to epf code.

from epf.

heartsentwined avatar heartsentwined commented on July 29, 2024

No idea what happened, but as @rayb said, I can no longer reproduce this bug. Perhaps a blanket gem update somewhere during these days did it. Closing issue.

from epf.

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.