Skip to content

DataItemのset時にエラーがあった時、それ以降のDataItemの操作でイベントが上がらなくなる。 #229

@fukudayasuo

Description

@fukudayasuo

内部でmanager.beginUpdate()が呼ばれ、endUpdate()が呼ばれる前にエラーで中断されるため、beginUpdate()が呼ばれっぱなしのままになってしまっているからだと思われる。

以下、検証コード。

    manager = h5.core.data.createManager('Manager');
    model = manager.createModel({
        name: 'Test',
        schema: {
            id: {
                id: true
            },
            v: {
                type: 'string'
            }
        }
    });
    item = model.create({
        id: '001'
    });

    item.addEventListener('change', function(e) {
        console.log(e)
    });
    try {
        item.set('v', 0); // error
    } catch (e) {
    }
    item.set('v', 'abc'); // イベントが上がらない

    manager.endUpdate();   // イベントが呼ばれる

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions