Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    zaptrem
    @zaptrem
    This just resolved the issue, thanks.
    zaptrem
    @zaptrem
    Can props.firebase.uploadFiles read file URIs? Not sure what kind of data it wants me to pass in, but I've got a URI for the file.
    illuminist
    @illuminist
    It's File objects gotten from <input type="file" />
    illuminist
    @illuminist
    I believe firebase.storage itself doesn't even support uploading file from URI
    zaptrem
    @zaptrem
    @illuminist The error says that it expects either a File or a Blob, so I handed it a blob with my data and it still failed with "Expected Blob or File."
    illuminist
    @illuminist
    Have you make sure that it is instanceof Blob?
    zaptrem
    @zaptrem
    Yeah, when I console.log it it gives a blob object that looks exactly like it should
    Here's my upload line
    let onlineURI = await firebase.uploadFiles(
        `users/${uid}/recordings`,
        file,
        `users/${uid}/recordings`
      );
    When I console.log the blob I get
    Blob {
      "_data": Object {
        "blobId": "AFE95FFC-C7F9-438F-A1E3-6DA08A7C9C84",
        "name": "477894CB-1A8F-4608-99E7-415E4434D14B.m4a",
        "offset": 0,
        "size": 22658,
        "type": "audio/x-m4a",
      },
    }
    Here's the exact error:
    FirebaseStorageError {
      "code_": "storage/invalid-argument",
      "message_": "Firebase Storage: Invalid argument in `put` at index 0: Expected Blob or File.",
      "name_": "FirebaseError",
      "serverResponse_": null,
    }
    illuminist
    @illuminist
    Try firebase.uploadFile without s
    zaptrem
    @zaptrem
    Might have fixed part of it
    now getting firebase.database is not a function. Does uploadFile know that I'm using Firestore?
    illuminist
    @illuminist
    It seem to have a config to use firestore instead of rtdb
    zaptrem
    @zaptrem
    Does it not get that status automatically like the other functions? If so, how should I pass that info to it?
    illuminist
    @illuminist
    In a config fore react-redux-firebase, set useFirestoreForStorageMeta to true
    zaptrem
    @zaptrem
    Thanks, that fixed it.
    zaptrem
    @zaptrem
    If I run that upload function and the app loses internet connection will the upload resume after? I read the Storage is supposed to do that kind of thing by default but am not sure if that applies here.
    illuminist
    @illuminist
    If firebase.storage do it internally then nothing need to be worry
    zaptrem
    @zaptrem
    Cool.
    And does this library support some sort of automatic caching of files in the redux store?
    illuminist
    @illuminist
    Files aren't supposed to be in redux store
    zaptrem
    @zaptrem
    Okay.
    zaptrem
    @zaptrem
    I'm using the below firestoreConnect function to send an array of firestore docs to a component to list. However, I just realized I also need access to the names of each of those docs. Is there any way I can make the name a field in each of these (I can wipe the database easily) using a link, or alternatively could I make this function return a dictionary instead (where every term is the doc name and definition is the data I have now)
    export default compose(
     firestoreConnect(() => {
         let uuid = firebase.auth().currentUser.uid;
         let address =  [{
            collection: 'users',
            doc: uuid,
            subcollections: [{ collection: 'recordings' }]
         }]
         //console.log(address);
         return address;
         }), // or { collection: 'todos' }
     connect((state, props) => {
       //console.log(state.firestore.ordered);
       //let list = state.firestore.ordered["users"];
       if (state.firestore.ordered["users"] != null)
       if (state.firestore.ordered["users"][0] != null)
       if (state.firestore.ordered["users"][0]["recordings"] != null) {
           console.log(state.firestore.ordered["users"][0]["recordings"]);
           return {recordings: state.firestore.ordered["users"][0]["recordings"]};
       }
       //console.log(state.firestore.ordered);
       return{};
     })
    )(RecordingList)
    illuminist
    @illuminist
    Do you want to access collection recording of every users doc or something?
    zaptrem
    @zaptrem
    @illuminist I need the doc name so I can .update() it when the user changes the title in the list.
    illuminist
    @illuminist
    Isn't doc name the UID of current user?
    zaptrem
    @zaptrem
    firestore automatically generates a random name for each of the docs
    An example path is users/{userId}/recordings/{recordingId}
    illuminist
    @illuminist
    And where is the issue?
    zaptrem
    @zaptrem
    The component above (RecordingList) is passed the contents of each recording doc, but that doesn't include the name of the doc itself.
    illuminist
    @illuminist
    What is your definition of your "name of the doc"?
    zaptrem
    @zaptrem
    illuminist
    @illuminist
    That is doc id
    zaptrem
    @zaptrem
    Yep, sorry for the confusion.
    illuminist
    @illuminist
    If you access a object from firestore.ordered it should already included those id property inside of each recording object in the array
    zaptrem
    @zaptrem
    I don't see it in the array: https://imgur.com/a/MmIdk2i
    the "id" there something I wrote leftover from before I added everything to firebase.
    illuminist
    @illuminist
    Ok you had another ID field and that got overwritten
    zaptrem
    @zaptrem
    alright, so if I delete that field from the object I'm add()ing the real ID will show up?
    illuminist
    @illuminist
    I guess so
    Still depend on which ID is a real ID for you
    zaptrem
    @zaptrem
    The other id was just a placeholder. You're right and remove it fixed it: https://imgur.com/a/bKUA6FP. Thanks
    illuminist
    @illuminist
    Ok good
    zaptrem
    @zaptrem
    when firebase.ordered() says the results are ordered, can the field they're ordered by be changed?
    illuminist
    @illuminist
    Yes
    zaptrem
    @zaptrem
    Found it.
    zaptrem
    @zaptrem
    Also here: http://docs.react-redux-firebase.com/history/v3.0.0/docs/queries.html#Formats . I thought ordered was something you guys added.
    illuminist
    @illuminist
    You need to refer to this https://github.com/prescottprue/redux-firestore for extensive use of redux-firestore. Redux-redux-firebase is just for shortguide to integrate redux-firestore into react.