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.

[Feature] persist results from find, get service methods in store

See original GitHub issue

It would be useful if the results of service get or find methods were also stored in store.records. Currently, they are cached in the queryResult key.

In my app, when server side rendering, I populate store.records with the relevant results for a given route (say the homepage - /).

If the user doesn’t begin their browsing on that page, the server-provided store won’t have records. When the user eventually navigates to /, I want to initiate the call to get the records in my componentDidMount hook in React. But then the results aren’t store.records.

I could merge the data from queryResults and store.records (throwing away any duplicates). At best, that’s a hacky fix because the next query I perform will clear the previous data in queryResults – and suppose the next query is a subset of the current results, then I’m throwing away data.

It would be preferable to have a single source of truth for all data for any particular service. Any time I call get or find, the data is persisted in store.records. It’s different from the current behavior – store.records stores records received from realtime events only.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
eddyystopcommented, Aug 11, 2017

I’ve read your issue several times and I wrote a long reply but the short of it is this. store.records is intended for replication engines which replicate part of a file. Only they know the selection criteria, so Feathers calls cannot be merged into store.records.

You seem to be using store.records as a cache. You are not taking mutations by others into account because I think you are using it only server side.

The approach I suggest is to implement a cache with a reducer which acts on the repo’s _FULFILLED action code for the service. It can either use store.records or extend the repo’s store. You could use the STORE action code to clear store.records.

0reactions
eddyystopcommented, Aug 17, 2017

I think we can close this. Feel free to reopen it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get-Service (Microsoft.PowerShell.Management)
The Get-Service cmdlet gets objects that represent the services on a computer, including running ... Example 2: Get services that begin with a...
Read more >
Get data from a server - Angular
This tutorial adds the following data persistence features with help from Angular's HttpClient . The HeroService gets hero data with HTTP requests ...
Read more >
1. Working with Spring Data Repositories
The actual result of parsing the method depends on the persistence store for which you create the query. However, there are some general...
Read more >
Introduction to Vertex AI Feature Store | Google Cloud
Learn more about Vertex AI Feature Store data model and resources. Any permitted user can search and retrieve values from the featurestore. For...
Read more >
Back to Basics: Understanding PowerShell Objects
By invoking methods on the service object itself, you can stop and retrieve the updated status all using a single object. Below you...
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