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

react-indexed-db is not throwing an error if failed to store in browser indexedDB #25

Open
Q8root opened this issue Jul 30, 2020 · 1 comment

Comments

@Q8root
Copy link

Q8root commented Jul 30, 2020

When i test with mobile device will full storage usage (Cannot store any new data on storage).

import React, { useEffect, useState, useRef, createRef } from "react";
import { initDB, useIndexedDB } from "react-indexed-db";

initDB(DBConfig);

const BookRead = (props) => {
const db = useIndexedDB("reads");

 db.add({
            hash: props.match.params.id,
            token: res.data.token,
            ss: "",
            sa: "",
          }).then(
            (event) => {
              db.getByIndex("hash", event).then((read) => {
                alert(read); //getting "undefined" 
                
              });
            },
            (error) => {
              return alert("Your device storage space is running out);
            }
          );

}

export default BookRead;

From above code, db.add should try to add data in indexedDB, if failed it run code under the error callback function, but what i got alert with "undefined" although the data is not saved in browser DB.

Is there any thing wrong with my code ?

@assuncaocharles
Copy link
Owner

Hey @Q8root

Thanks for reporting it, we gonna have a look into it

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

No branches or pull requests

2 participants