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

  • SEARCH
  • Home
  • 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 8824461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:38:26+00:00 2026-06-14T06:38:26+00:00

Explanation: I’m using ember-data for a project of mine and I have a question

  • 0

Explanation:

I’m using ember-data for a project of mine and I have a question that revolves around the possibility of dirtying an object and then setting its state to clean again on purpose – without commiting the changes. The scenario is this:

Say I’ve fetched an object via banana = App.Fruit.find('banana'); and it has a description of “Yellow fruit!”. Using XHR long-polling (or WebSockets), I may receive an updated version of the object because of another user having changed the description to “A tasty yellow fruit!” at any given point in time after I fetched the original object.

Then, what I would like to do is to update the object to reflect the newly received data. For this, I’ve tried different approaches:

  • I’ve tried calling App.Store.load(App.Fruit, new_data);. First of all, this approach doesn’t work and secondly, this is not really what I want. I could’ve made uncommitted changes to the object myself and in this case, it would be undesirable to just discard those (assuming the load() call would overwrite them).

  • I’ve tried looping through the new data, calling .set() – like so: banana.set('description', new_data.description); – in order to update the object properties with the new data (where applicable = not dirty). This works but it leaves the object in a dirtied state.

In order to make the object clean/updated again – and not have the adapter commit the changes! – I’ve taken a look at the states the object travels through. These are (at least):

  • Step 1: Initially, the object is in the rootState.loaded.saved state.
  • Step 2: Calling .set() on a property pushes it to the rootState.loaded.updated.uncommitted state.
  • Step 3: Calling App.store.commit(); returns the object to the rootState.loaded.saved state.

Therefore, I’ve tried to manually set the object state to saved after step 2 like so: banana.get('stateManager').goToState('saved');.

However, this doesn’t work. The next time the store commits for any other reason, this maneuver produces an inFlightDirtyReasons is undefined error.

Question:

My question is: how can I manually change the state of a dirtied object back to clean (saved) again?

  • 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-14T06:38:27+00:00Added an answer on June 14, 2026 at 6:38 am

    Looking at ember-data the uncommitted state has a ‘becameClean’ event which consequently sets the record as loaded.saved.

    This should do the trick

    record.get('stateManager').send('becameClean');  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Explanation: Let's say I have an object graph that's nested several levels deep and
Explanation I have a multidimensional array that is iterated over to created a categorized
Explanation of scenario: I have a jquery window that will load up with a
Explanation: I have a JSF command link that sets a member in the backing
Some explanation: for a project I'm working on I have to write a program
full explanation: I'm working on a project to generate twitter links that post over
Explanation: I have a page with a content div that will change height. When
I need the deep explanation for the queries that are not using the temporary
Explanation: i have few objects and im declaring them inside $(document).ready(). WHY? because in
Quick Explanation One Silverlight (3.0) project with several XAML pages. I want to load

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.