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.

[Bug] MakeFindMixin: local option doesn't works as specified in the docs

See original GitHub issue

Steps to reproduce

In a template, add a makeFindMixin like this:

mixins:[ makeFindMixin({ service: "yourServiceName", local: true, params: () => ({}) }) ]

Expected behavior

The mixin should not make a request to the API server but use the params to pull data from the local store as stated in the docs.

local {Boolean|String|Function} - when true, will only use the params prop to pull data from the local Vuex store. It will disable queries to the API server. The value of local will override queryWhen. Default:false

Actual behavior

The API request is sent, the local option is not respected. If you omit the params option, the API request is not sent but the store getter returns nothing.

What cause this behavior

In the created lifeCycle event, on this line , only the presence of the params and fetchParams options are checked in order to make the API request.

If they are not present, the absence of the local option is used to log a message.

How to fix it

Check the truthiness of the local option to send the API request or not. I can submit a PR if everything is ok.

System configuration

Module versions: 3.2.1

NodeJS version: 12.4.0

Operating System: Linux

Browser Version: Chromium 79

Module Loader: Webpack

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
marshallswaincommented, Dec 30, 2019

That is a very good point. Nice job looking even further ahead. That will be a great optimization.

1reaction
J3m5commented, Dec 30, 2019

OK but why in the watcher? We could put it simply at the beginning of the created event, no? What would be the difference?

Correct me if I’m wrong but isn’t the purpose of the created event to only make the find request when it is triggered and when the params change?

In that case, we could even add the created property conditionally, it would make the mixin lighter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

feathersjs - Bountysource
I am getting the error stated above, $FeathersVuex is undefined. ... ReplaceItems option doesn't works when patching/updating value with null $ 0.
Read more >
feathers-vuex: Versions - Openbase
This fixes the useFind Vue Composition API utility. The haveLoaded property will now always be set to true when local: true is enabled...
Read more >
vuex 4 documentation - Barbara Chiarelli
Vuex 4 is the version that's made to work with Vue 3. createMutationsSharer ( [options]) Creates a new instance of the plugin with...
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