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

Error thrown while aborting fetch #80

Open
ncortines opened this issue Mar 4, 2015 · 0 comments
Open

Error thrown while aborting fetch #80

ncortines opened this issue Mar 4, 2015 · 0 comments

Comments

@ncortines
Copy link

Hi,

I found that triggering abort on a fetch operation with a range condition works fine:

movies.fetch({
    conditions: {
        title: ['A', 'Z']
    }
}).abort()

However when specifying a single value condition error is thrown upon abort invocation:

movies.fetch({
    conditions: {
        title: 'Goonies'
    }
}).abort()

throws Uncaught DataError: Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.

The problem since to lay in this piece of code, which seems to asume the first case scenario:

if (bounds && options.conditions[index.keyPath]) {
    cursor.continue(options.conditions[index.keyPath][1] + 1); /* We need to 'terminate' the cursor cleany, by moving to the end */

The following seems to fix the problem:

if (bounds && options.conditions[index.keyPath] && _.isArray(options.conditions[index.keyPath])) {
    cursor.continue(options.conditions[index.keyPath][1] + 1); /* We need to 'terminate' the cursor cleany, by moving to the end */

Please let me know what do you think.

Thanks!

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

No branches or pull requests

1 participant