question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat(core): method to expose instance for use in redux-saga and redux-thunk

See original GitHub issue

I experience issues when fetching data with the get operator. Works seamlessly when adding data to Firestore though.

Tested on master and v0.1.0-alpha.2 – using react-redux-firebase as the base, but since they have made redux-firestore optional it’s a combination of the two.

Uncaught (in promise) TypeError: Cannot read property 'collection' of undefined

Any idea why?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
karltaylorcommented, Mar 7, 2018

If anyone came across this, this is working. And you can setup using both getFirebase and getFirestore by passing in multiple arguments to applyMiddleware.

const store = createStore(
  rootReducer,
  compose(
    applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
    reactReduxFirebase(firebase, {
      userProfile: 'users',
      enableLogging: false
    }),
    reduxFirestore(firebase),
    ...enhancers
  )
)

and within your thunk:

export default function foo () {
  return function (dispatch, getState, { getFirebase, getFirestore }) {
    const firebase = getFirebase()
    const firestore = getFirestore()
    // do some magic thanks to @prescottprue
  }
}
0reactions
davidohlincommented, Oct 26, 2019

@prescottprue Yes, getFirebase().firestore() works, I’ll use that for now. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to load data in React with redux-thunk, redux-saga ...
This article is going to show 4 ways of solving this problem and compare pros and cons of each one. It isn't a...
Read more >
React Redux Thunk Crash Course - Middleware & Make ...
Make HTTP requests with Redux Thunk in React. Redux Thunk middleware allows you to write action creators that return a function instead of ......
Read more >
Understanding Redux Saga: From action creators to sagas
Learn how to use Redux Saga for both simple and complex approaches to implementing async operations with action creators, thunks, and sagas.
Read more >
Redux-Thunk vs. Redux-Saga - Medium
In the context of Redux, Redux-Thunk middleware allows you to write action creators that return a function instead of the typical action object....
Read more >
Redux Toolkit Combine Slices - polley-design
In Redux-Toolkit, the createSlice method helps us create a slice of that redux-store, ... To make HTTP API call, we will be using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found