Hybrid 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

  2. #2
    Sencha User
    Join Date
    Apr 2010
    Posts
    107
    Vote Rating
    -1
    merrells is an unknown quantity at this point

      0  

    Default


    Wow. Thanks!

    We're now working on complete support for the date field in the sync store.
    Somehow we (actually me) failed to implement and test that fully.
    It'll be in the next release of the SDK.

    Thanks for your feedback and fixes. It's much appreciated.

    John

  3. #3
    Sencha - IO Dev Team
    Join Date
    Apr 2011
    Posts
    84
    Vote Rating
    5
    jason.cline is on a distinguished road

      0  

    Default


    Thank you for helping describe and fix this problem. We have date fields properly replicating between the client and server now and this fix will be part of the release we are planning for next week.

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

      0  

    Default


    @John and Jason: thank you guys for these updates

    I'm glad to hear that you finally managed to add date support and that this report helped you a bit.

    Did you also handled null value for date field with allowNull == true (bug described in this thread) ?

  5. #5
    Sencha - IO Dev Team
    Join Date
    Apr 2011
    Posts
    84
    Vote Rating
    5
    jason.cline is on a distinguished road

      0  

    Default


    0.7.13 should resolve these issues.

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

      0  

    Default


    Upgraded my project to version 0.7.13, and I confirm that this issue is fixed

    Thanks

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