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

"strategy=always" does not trigger brand new request #92

Open
elixiao opened this issue Jan 30, 2018 · 12 comments
Open

"strategy=always" does not trigger brand new request #92

elixiao opened this issue Jan 30, 2018 · 12 comments
Labels

Comments

@elixiao
Copy link

elixiao commented Jan 30, 2018

How could I trigger brand new request every time I use service.find? strategy=always does not work, and listStrategy=always does not work either. There is still no http request in my browser console. So what's the difference between strategy and listStrategy? (I see them both in README.md). Which one fulfill my purpose? Following is my code:

// feathers.service.ts
this.app = feathers()
  .configure(reactive({
    idField: '_id',
    listStrategy: 'always',
    strategy: 'always'
  }))
  .configure(rest(HOST).angularHttpClient(httpClient, {HttpHeaders}))
  .configure(hooks())
  .configure(authentication({path: '/login', storage: window.localStorage}))   
// role.component.ts
getRoles() {
  const Role = this.feathersService.app.service('roles')
  const log = console.log
  Role
    .watch({listStrategy: 'always', strategy: 'always'})
    .find()
    .subscribe(log,log)
}
@j2L4e
Copy link
Collaborator

j2L4e commented Feb 14, 2018

Does your problem persist with the new version?

@elixiao
Copy link
Author

elixiao commented Feb 23, 2018

upgrading to latest version shows me the following error:

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'mixins' of undefined
TypeError: Cannot read property 'mixins' of undefined

@daffl daffl added the bug label Apr 25, 2018
@dottodot
Copy link

Not working for me either, causing major issues, any ideas on a fix

@dottodot
Copy link

The reason this is an issue is it you have a list view that has different populated fields to the edit view it seems to break the population if you go back to edit the same item. The only way they stay in sync is by populating the find and get requests with the same fields, but I don't want to do that.

@dottodot
Copy link

dottodot commented Aug 6, 2018

Does anyone have a work around for this issue. It's causing me some issues and I'd prefer not to have find an alternative.

@j2L4e
Copy link
Collaborator

j2L4e commented Aug 6, 2018

Seems like a caching issue to me.

@daffl I think baking caching right into the plugin wasn't exactly the best of ideas
we should refactor caching to make it configurable like sorters and matchers are.

@dottodot
Copy link

dottodot commented Aug 6, 2018

Maybe caching should just be disable for always. As the docs state

always - Re-runs the original query to always get fresh data from the server on any matching real-time event

so in this case caching doesn't make sense as you want the fresh data from the server.

@j2L4e
Copy link
Collaborator

j2L4e commented Aug 6, 2018

it DOES get new data from the server when an event occured. It just doesn't request new data when you subscribe twice with the same query.

Making caching configurable shouldn't be too much work. PRs welcome ;)

@dottodot
Copy link

dottodot commented Aug 6, 2018

Would it be as simple as adding say cache: true to the options then checking for that in list.js at this point.

   if (cachedObservable) {
      return cachedObservable;
    }

@j2L4e
Copy link
Collaborator

j2L4e commented Aug 6, 2018

To disable caching on your local version change return cacheObservable(this._cache, 'find', params ,pipeStream); to return pipeStream;

I think we'd need to figure out the API for a user provided cache, most likely some kind of object with cache, get and invalidate methods

@thor836
Copy link

thor836 commented Sep 19, 2018

upgrading to latest version shows me the following error:

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'mixins' of undefined
TypeError: Cannot read property 'mixins' of undefined

Does anyone have a work around for this?

@daffl
Copy link
Member

daffl commented Sep 19, 2018

Please create a new issue with an example to reproduce.

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

5 participants