csantanapr / dapp-examples

Series of Single Page Apps using the dApp Framework
http://csantanapr.github.io/dapp-examples
Other
5 stars 4 forks source link

Uncaught DataCloneError: An object could not be cloned. #31

Open csantanapr opened 11 years ago

csantanapr commented 11 years ago

Steps Reproduce: Click Search Button Click Submit

Results: Uncaught DataCloneError: An object could not be cloned on History Controller Also the newHash does get put on url

More details: When doing a reverse transition with data using app.transitionToView I get Uncaught DataCloneError: An object could not be cloned. In dojox/app/controllers/History or app/controllers/CustomHistory in this line: history.replaceState(this.currentState, this.currentState.href, currentHash);

view.app.transitionToView(view.domNode, { target: 'requestList', reverse: true, data: {'searchFunction': searchFunction} });

If I just do reverse transition with no data property present then exception doesn't occur

csantanapr commented 11 years ago

@edchat can you take a look at this issue?

edchat commented 11 years ago

The problem is that you are passing a function in the data on the transition (data.searchFunction), and this is causing the problem. You need to pass a string or a object in data (which can be cloned) and not a function to the transition. So you can pass a boolean to indcate that a search is to be done, but not the function itself.

view.app.transitionToView(view.domNode, { target: 'requestList', reverse: 'true', 'data': {'searchFunction': searchFunction}});