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

Route for project/${project.id} is dead #82

Closed
hcwiley opened this issue Jan 10, 2018 · 5 comments
Closed

Route for project/${project.id} is dead #82

hcwiley opened this issue Jan 10, 2018 · 5 comments
Assignees
Labels

Comments

@hcwiley
Copy link

hcwiley commented Jan 10, 2018

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Project page has no data from firebase store project.

What is the expected behavior?
It should display the project name and then the json below that

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?
I would image all browsers. I don't know about previous versions.

@hcwiley
Copy link
Author

hcwiley commented Jan 10, 2018

I'm not sure why this is using firebaseConnect when the project is made using firestore

@hcwiley
Copy link
Author

hcwiley commented Jan 10, 2018

to be clear, i ran yo react-firebase and did the additional setup with material, firestore.

@prescottprue
Copy link
Owner

@hcwiley You are correct, when selecting Firestore, it should use firestoreConnect instead of `firebaseConnect.

@prescottprue prescottprue self-assigned this Jan 10, 2018
@hcwiley
Copy link
Author

hcwiley commented Jan 10, 2018

I've changed the ProjectPage.enhancer.js to look like this and it is working:

import { compose } from 'redux'
import { connect } from 'react-redux'
import { firestoreConnect, getVal } from 'react-redux-firebase'
import { spinnerWhileLoading } from 'utils/components'
import { UserIsAuthenticated } from 'utils/router'

export default compose(
  // redirect to /login if user is not logged in
  UserIsAuthenticated,
  // Map auth uid from state to props
  connect(({ firebase: { auth: { uid } } }) => ({ uid })),
  // Wait for uid to exist before going further
  spinnerWhileLoading(['uid']),
  // Create listeners based on current users UID
  firestoreConnect(({ params, uid }) => [
    // Listener for projects the current user created
    {
      collection: 'projects',
      where: ['createdBy', '==', uid]
    }
  ]),
  spinnerWhileLoading(['firestore']),
  // // Map projects from state to props
  connect(({ firestore: { data } }, {params}) => ({
    project: getVal(data, `projects/${params.projectname}`)
  })),
  // Show loading spinner while project is loading
  spinnerWhileLoading(['project'])
)

prescottprue pushed a commit that referenced this issue Jan 11, 2018
@prescottprue prescottprue mentioned this issue Jan 13, 2018
2 tasks
prescottprue added a commit that referenced this issue Jan 13, 2018
* fix(generator): fix project page enhancer - #82
* fix(generator): removed lint from Firestore and Non Firestore templates
* fix(generator): removed unused config objects from `project.config`
@prescottprue
Copy link
Owner

@hcwiley The changes that you mentioned have been added, and published in v2.0.0-rc.2. Don't forget to update using npm i -g generator-react-firebase otherwise you will not get the changes.

Let me know if it doesn't work as intended for you, thanks for reporting!

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

No branches or pull requests

2 participants