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.

Save last query & timestamp by default

See original GitHub issue

Steps to reproduce

  1. dispatch a find in one page of your app.
  2. Navigate to another that effectively needs the same data.

Expected behavior

We should have a way to tell how old the cache is and what query populated it. That would allow us to say, not run the query again if it was ran less than a minute ago.

Actual behavior

The cache has no origin information, no information about whether the connection dropped since it was populated and no information about the query that populated it. Therefore, we have no guarantees about the data and are thus forced to implement our optimization or fire the potentially non-trivial query again.

Working with feathers-vuex is currently quite wordy… we should look for ways to cut down lines for the typical app.

Proposed Solution

Lets add a property to the vuex state with

last: {
  createdAt: 14245678921
  query: 'find'
  params: '{}'
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
FossPrimecommented, Oct 3, 2018

fun real world edge case:

Google play music will only get the playlist list once and pull from cache every time you go to the playlist list page. It will reactively add to the list, but if your laptop is asleep, you’ll end up with missing playlists even though you’ve “browsed” back and forth between pages inside Google Play Music.

AllGet would solve this, but it would be expensive for Google. AllGet([id, maxAge]) would fix the problem without hitting the server every time.


Off topic, I would really love built in eager updates support that doesn’t require a local proxy copy to support vuex strict mode. Something like patch([id, params, vuexParams]) where I can say {eager: true, rollback: false}.

1reaction
marshallswaincommented, Oct 3, 2018

I also like the idea of a maxAge-based cache. As a baby step towards this, I’ve added a createdAt timestamp to the pagination data in feathers-vuex@1.6.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saving last SQL query state in PHP - Stack Overflow
In the query, filter out all entries with a last_updated that is before the last time the query was executed (or possibly the...
Read more >
11.2.5 Automatic Initialization and Updating for TIMESTAMP ...
To specify automatic properties, use the DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses in column definitions. The order of the clauses does ...
Read more >
MySQL Best approach for recording last update timestamp for ...
MySQL Best approach for recording last update timestamp for every column and every row · 1. Create an additional timestamp column for each...
Read more >
How to Update Current Timestamp in MySQL? - GeeksforGeeks
In MySQL, there is a facility to keep the default current timestamp ... Query: ALTER TABLE employee MODIFY COLUMN empLoginTime TIMESTAMP ...
Read more >
Timestamp functions in Google Standard SQL | Cloud Spanner
Google Standard SQL for Spanner supports the following timestamp functions. ... For example, the following query will select the function in the now...
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