Skip to content

[0.6] Transaction becomes inactive too quickly #34

Description

@glsignal

I've run into an odd issue using 0.6.0-rc2 where the transaction becomes inactive before nodeStore.add, do you have any ideas on why this might happen or how to avoid it? This implementation seems like a valid approach, but I might be missing something fundamental here.

    let tx = this.db.transaction(['nodes', 'assignments'], 'write');
    let assignmentStore = tx.store('assignments');
    let nodeStore = tx.store('nodes');

    let assignment = {
      title:        "Untitled (" + RandomName.get() + ")",
      description:  "Created " + new Date().toDateString()
    };

    // Populate the localId while we're here
    assignment.localId = await assignmentStore.add(assignment);

    let node = {
      localAssignmentId: assignment.localId,
      tabId:             payload.tabId,
      title:             payload.tabObj.title,
      url:               payload.tabObj.url
    };

    node.localId = await nodeStore.add(node);

    tx.then(() => { ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions