Skip to content
This repository

DATA_PROXY should be instantiated each time. Fix for #140 #141

Closed
wants to merge 1 commit into from

2 participants

Cortland Klein Peter Wagenet
Cortland Klein

This is a fix for #140.

Sorry, I don't have time to write tests for this at the moment.

Peter Wagenet
Owner

@pixelcort I hope you understand that we can't do any merges without tests. Also, this no longer merges cleanly. I'm going to close if for now, but if you have chances to get an up to date PR, we'd love to have it. Thanks!

Peter Wagenet wagenet closed this April 10, 2012
Cortland Klein

I'm sorry, but I don't have time at the moment to update this. I wasn't expecting it to be merged in without tests; I was hoping someone else might have had time to write some proper tests for this. #140 is still open if anyone else would like to take a shot at it.

The underlying issue is that there are cases when the store can end up needing another instance of the DATA_PROXY for another purpose, and by reusing the same one, later on the outer invocation of store thus holds bad data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 06, 2012
DATA_PROXY should be instantiated each time it is needed so it is rec…
…ursive-safe. Fixes #140
c6eabc9
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 10 additions and 6 deletions. Show diff stats Hide diff stats

  1. 16  packages/ember-data/lib/system/store.js
16  packages/ember-data/lib/system/store.js
@@ -3,12 +3,6 @@ require("ember-data/system/transaction");
3 3
 
4 4
 var get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;
5 5
 
6  
-var DATA_PROXY = {
7  
-  get: function(name) {
8  
-    return this.savedData[name];
9  
-  }
10  
-};
11  
-
12 6
 
13 7
 // Implementors Note:
14 8
 //
@@ -551,6 +545,11 @@ DS.Store = Ember.Object.extend({
551 545
         if (record = recordCache[clientId]) {
552 546
           proxy = get(record, 'data');
553 547
         } else {
  548
+          var DATA_PROXY = {
  549
+            get: function(name) {
  550
+              return this.savedData[name];
  551
+            }
  552
+          };
554 553
           DATA_PROXY.savedData = hash;
555 554
           proxy = DATA_PROXY;
556 555
         }
@@ -689,6 +688,11 @@ DS.Store = Ember.Object.extend({
689 688
       clientId = this.pushHash(hash, id, type);
690 689
     }
691 690
 
  691
+    var DATA_PROXY = {
  692
+      get: function(name) {
  693
+        return this.savedData[name];
  694
+      }
  695
+    };
692 696
     DATA_PROXY.savedData = hash;
693 697
     this.updateModelArrays(type, clientId, DATA_PROXY);
694 698
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.