Threaded View

  1. #1
    Sencha - Dev Team
    Join Date
    Aug 2012
    Location
    France
    Posts
    23
    Vote Rating
    0
    NiNiX is on a distinguished road

      0  

    Default [0.7.10] date fields are not synchronized when updated

    [0.7.10] date fields are not synchronized when updated


    Versions: 0.7.10 (and 0.7.8) with Sencha Touch 2.1.1
    Browser: Chrome 24 (Win8 / Desktop)
    Severity: critical (data loss)
    Attachment: 0.7.10 patch proposal

    If updating a field handling a date object (for instance the date type field), this one is not synchronized when calling sync(). It's the case for all (custom) types which convert their raw value into Date (not only for the date field).

    Test case

    I modified the 'examples/touch/todo' example, replacing the timestamp 'int' type to 'date' (code detailed in this thread)

    - Create a new todo called 'A' and save it
    - Edit 'A', add a description and save. According the SIO log, data have been updated and sent to the remote server:
    Code:
    [...]
    DEBUG: Protocol.sendPutUpdate: {Object ...}
    DEBUG: Protocol.sync: end Object {r: "ok", sent: 2, status: "success"}
    [...]
    - Edit 'A', show the 'save' button by doing and undoing a modification (e.g., change the 'complete' value to true, then false). Like that, only the timestamp field will change when saving the record. Save and check the SIO debug log:
    Code:
    [...]
    DEBUG: Protocol.sendPutUpdate: no work
    DEBUG: Protocol.sync: end Object {r: "ok", sent: 0}
    [...]
    No data have been sent even if the timestamp has changed. Note that even if you update another field (e.g. the todo label), only the label field will be synchronized. The date field will be synchronized just once, at record creation.

    Debug

    In SIO code, you are considering date as a complex value type. If setUpdateStateValue method arguments (cf/data/ModelWrapper.js) are dates, when checking if the value should be updated, you are trying to iterate over date objects (which are not iterables) and found no update because Ext.Array.intersect will return empty when intersecting 2 dates. To make it work, I changed calls to this.eco.isComplexValueType() for a custom implementation, this._isIterable():
    PHP Code:
    [...]
        
    _isIterable: function(value) {
            return (
                
    value !== null &&
                !
    Ext.isDate(value) &&
                
    typeof value === 'object');
        },

        
    setUpdateStateValue: function(tpathbefore_valueafter_value) {
            if (
    this._isIterable(after_value)) {
                var 
    addedname2;
                if (
    before_value) {
                    
    added= {};
                    if (
    this._isIterable(before_value)) {
    [...] 
    I attached the full patch over 0.7.10 used for my project (renamed in .txt, the forum doesn't accept .diff or .patch files).

    I know that SIO does not work well with date, and using date field is not recommended, but I hope this report will help you in this quest
    Attached Files

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi