Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fukudayasuo opened this issue Jul 26, 2013 · 1 comment
Assignees
Labels
bug
Milestone

Comments

@fukudayasuo
Copy link

@fukudayasuo fukudayasuo commented Jul 26, 2013

内部で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();   // イベントが呼ばれる
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Jul 26, 2013
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Jul 26, 2013
@fukudayasuo
Copy link
Author

@fukudayasuo fukudayasuo commented Jul 26, 2013

model.create();でエラーが起きた時も同様の現象が起きてたので、model.createも修正します。

model.addEventListener('itemsChange', function(e) {
    console.log(e);
});
try {
    model.create({
        id: '001',
        v: 0
    });
} catch (e) {
}
model.create({
    id: '001',
    v: 'abc'
}); // イベントが上がらない
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Jul 26, 2013
@ghost ghost assigned fukudayasuo Aug 8, 2013
@simdy simdy closed this Aug 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.