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.

Dealing with multiple queries on the same route

See original GitHub issue

I would like to make a couple of queries to the same path, but with different params. However, these queries are stored in the store based on ‘path’ param.

Example:

@firebaseConnect((props) => ([
  { path: 'goals', queryParams: [ `orderByChild=partner`, `equalTo=partnerId`] },
  { path: 'goals', queryParams: [ `orderByChild=expert`, `equalTo=expertId`] },
]))
@connect(({ firebase }, props) => ({
  ???
}))

Would it be possible to name a path for the queries to be stored at?

Example of the feature:

@firebaseConnect(() => ([
  { path: 'goals', storeAs: 'partnerGoals', queryParams: [ `orderByChild=partner`, `equalTo=partnerId`] },
  { path: 'goals', storeAs: 'expertGoals', queryParams: [ `orderByChild=expert`, `equalTo=expertId`] },
]))
@connect(({ firebase }) => ({
  partnerGoals: helpers.dataToJS(firebase, 'partnerGoals'),
  expertGoals: helpers.dataToJS(firebase, 'expertGoals'),
}))

I think this solution would also help with issue #55 whereas I could just store the data under different paths, so they would not be mixed and I would save some calls to the database.

Ideas?

Edit: Checked the source and I see you have dest variable ( link ), but I couldn’t find how it’s used.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DeividasKcommented, Feb 21, 2017

Works like a charm!

1reaction
prescottpruecommented, Feb 15, 2017

There has been progress on this functionality. Hoping to get it into one of the upcoming release candidates so it can make it into v1.3.0.

Will post here when there is a published version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle multiple queries by same route? - Laracasts
I strongly advise against doing this though, consider just having different routes for each resource. Thanks, I created separate routes for each type....
Read more >
Digging Deeper into Node.js: Accessing multiple queries ...
So I decided to access multiple queries within the same post request. To start, I created the Knex queries that would be sent...
Read more >
Running two queries on the same table and implement them ...
1 Answer 1 ... You can only send the response ( res.render(...) ) once you have the result of both queries. Therefore you...
Read more >
Quickly Change Multiple Queries, Same Source in Power Query
If you've created multiple queries from the same source and then the location of that source changes, you'd think that you would need...
Read more >
Use a union query to combine multiple queries into a single ...
As you select fields, make sure that you add the same number of fields, in the same order, that you add to the...
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