Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

[bug] observe handler is not called on deletion of the only row in a table #209

Open
chuan6 opened this issue Jun 1, 2017 · 2 comments
Open
Assignees
Labels

Comments

@chuan6
Copy link

chuan6 commented Jun 1, 2017

Hi,

I've constructed a codepen example at here to demonstrate the problem.

The higher level steps to recreate the situation are as follows:

  1. create an empty table;
  2. insert a row into it;
  3. define a simple query db.select().from(table), and start observing on it;
  4. delete the row from the table;
  5. the row was deleted, but the observe handler was never called.

The issue is rather specific in that,

  1. if there are more than one row in the table, all following deletions will be observed;
  2. if we started observing before insertion of the only row, the following deletion will also be observed.

Please let me know if there is any information that I can provide to help pinning down the problem.

Thanks :)

@freshp86 freshp86 self-assigned this Jun 1, 2017
@freshp86
Copy link
Contributor

freshp86 commented Jun 1, 2017

I am able to reproduce the problem, with a slight twist. See another minimal example at https://jsfiddle.net/bfj9c3m8/4/ (note the comment in the code).

It seems that manually executing the observed query once, after the observe() is a workaround. See similar workaround with your minimal example at https://jsfiddle.net/926vvccn/. I will look into the proper fix.

@chuan6
Copy link
Author

chuan6 commented Jun 2, 2017

The workaround solution also works in my case; will use it as a temporary solution. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants