Code Monkey home page Code Monkey logo

Comments (8)

guylabs avatar guylabs commented on July 23, 2024 1

Hi @ahatius,

sorry for my late reply but I hadn't the time to look into it. This nice little project runs and I analyzed your domain model and one issue is that you have cyclic dependencies as shown in this diagram:

cyclic-dependencies

Therefore the problem is that you call the SpringDataRestAdapter recursively and then it will never stop because of this cyclic dependencies.

I will check to add a flag to disable this check that the link was already fetched as this is an issue but then you must not have cyclic dependencies.

I would propose that you remove these dependencies and then update the project and I can check again for the flag such that you get the proper responses.

Would that be ok for you?

Thanks and regards,

Guy

from angular-spring-data-rest.

guylabs avatar guylabs commented on July 23, 2024

Hi @ahatius,

can you please provide me an example of what you are doing with the filter and without the filter it works properly right? You can also use the caching of the $http service described here such that you do not call the back end multiple times with the same request: https://docs.angularjs.org/api/ng/service/$http#caching

Thanks and regards,

Guy

from angular-spring-data-rest.

ahatius avatar ahatius commented on July 23, 2024

Hi Guy

Thanks for the fast reply :)

Actually my wording was not quite correct when I said filter. I'm not using an angular filter, I was actually referencing the comment on line 261 in angular-spring-data-rest-provider.js. According to that every resource will be fetched only once.

However, I tried to copy my JSON responses and noticed that they are way too big to copy in here, so I created a small, simple project which provides an example of my problem. Maybe I'm doing something wrong and that's the reason for my issue.

You can find the example project here. The project just needs to be checked out and started, everything else should be automatically initialized so you just need to navigate to http://localhost:8080/index. I have also added a screenshot of how it looks, what it's supposed to look like and what the final JSON object looks like.

I'd be really glad if you could have a look at it if you have a moment.

from angular-spring-data-rest.

ahatius avatar ahatius commented on July 23, 2024

Hi Guy

Thank you very much for that analysis.

I think that should be feasible. I have removed the circular dependencies for the Product, ProductRate and ProductCategory entities in the test project. I have also removed them for the Job and JobDetail entities, although those didn't seem to be problematic.

Cheers,
Ahatius

from angular-spring-data-rest.

guylabs avatar guylabs commented on July 23, 2024

Hey Ahatius,

nice I am glad to hear that. I will try to integrate the new flag as soon as I have more time and then I will do a new release.

Thanks and regards,

Guy

from angular-spring-data-rest.

torsten-sauer avatar torsten-sauer commented on July 23, 2024

I have the same problem here. I have a directive which loads a tree recursivly from my server (using the recursive=true option for SpringDataRestAdapter.process and given links to follow) . If I add the directive twice on a single page, one tree is fully populated, the other one has only its root nodes.

I can see that the request for the "root nodes" is made twice, but the following requests which dive deeper are done only once and the resolved response is in one case only filled with the root nodes, the other one has all childs that were fetched.

It is very complicated to build up a standalone testcase, but maybe you can have a look at the screenshot. It is a console.log from the two responses. The first is with empty 'childDiagnosisGroups', the second includes them as object. You can see that the link is for both the same, the initial requests are identical. If I make another call to it, it results everytime the full tree. I think this two requests get grouped at some point and the links are followed only once (good for performance), but the resulting data isn't distributed to every call.

spring-data-rest-problem

Hope that helps to explain the problem and make further investigation possible

from angular-spring-data-rest.

guylabs avatar guylabs commented on July 23, 2024

Hi

the flag fetchMultiple flag has been added. Read more here in the documentation: https://github.com/guylabs/angular-spring-data-rest#how-to-automatically-fetch-links (nead the end of the section)

I will now release 0.4.5 and then you can update and adapt your projects.

Regards,

Guy

from angular-spring-data-rest.

ahatius avatar ahatius commented on July 23, 2024

Thank you very much, will try it out ;)

from angular-spring-data-rest.

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.