Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:46:33+00:00 2026-06-17T21:46:33+00:00

I think I’ve found a bug when you add a child entity to another

  • 0

I think I’ve found a bug when you add a child entity to another entity and then mark the child entity as deleted (Without saving changes previously).

Here is the test:

test("delete unsaved entity", 1, function () {
    var realEm = newEm();
    //ok(realEm.hasChanges() === false, "The entity manager must not have changes");
    var query = EntityQuery.from("Customers")
        .where("CustomerID", "==", "729de505-ea6d-4cdf-89f6-0360ad37bde7")
        .expand("Orders");
    stop();
    realEm.executeQuery(query)
        .then(function (data) {
            var cust = ko.observable(data.results[0]);
            var newOrder = realEm.createEntity("Order", {}, breeze.EntityState.Detached);
            cust().Orders.push(newOrder);
            //ok(newOrder.entityAspect.entityState.isAdded() === true, "The entity is Added");
            newOrder.entityAspect.setDeleted();
            //ok(realEm.hasChanges() === true, "The entity manager must have changes? Not clear to me but it's true");
            realEm.saveChanges();
            ok(realEm.hasChanges() === false, "The entity manager must not have changes");
        })
    .fin(start);
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:46:34+00:00Added an answer on June 17, 2026 at 9:46 pm

    As of breeze v1.0.0 this bug is now fixed. Sorry for the delay

    Old post below

    Thanks for the repro, it really helps. There is a bug here and it will be fixed in the next release probably later today or early tomorrow.

    Just to be clear the bug is that the ‘hasChanges’ call after the ‘setDeleted’ call should return false, but currently returns true. The reason is that deleting an ‘added’ record simply detaches the entity from the entityManager; hence reverting the entityManager to the state it was in before the ‘add’. The detach does occur, but the hasChanges function is broken in this case.

    Two other issues though.

    First, you can replace this line

     var cust = ko.observable(data.results[0]);
    

    with this

     var cust = data.results[0];
    

    because Breeze will automatically create ko observables out of any entity returned from a query.

    and second your call to saveChanges

      realEm.saveChanges();
      ok(realEm.hasChanges() === false);
    

    needs to be converted to a promise, because saveChanges is asynchonous.

      realEm.saveChanges().then(function(r) { 
          ok(realEm.hasChanges() === false);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I found a bug in the static contract checking tool. Is there
Think you are the proud owner of Facebook, then which data you want to
Think of this: A view controller's view is added as subview to another view.
I think this is pretty straightforward but I've been trying for days without a
Think about doing this: import matplotlib.pyplot as plt plt.plot(x_A,y_A,'g--') plt.plot(x_B,y_B,'r-o') plt.show() How would you
Think I have an integer array like this: a[0]=60; a[1]=321; a[2]=5; now I want
Think my problem is I am trying to sum a count in the same
Think about the following: Your ISP offers you a dynamic ip-address (for example 123.123.123.123).
Think: tiling my emacs window with eshells, a la xmonad. Is this possible? I
I think that handlers in android are tools to get different objects that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.