Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

@Persistence decorator not working in feature module #636

Closed
floinay opened this issue Apr 6, 2021 · 6 comments
Closed

@Persistence decorator not working in feature module #636

floinay opened this issue Apr 6, 2021 · 6 comments

Comments

@floinay
Copy link

floinay commented Apr 6, 2021

Hi, i try use state with @persistence in feature module, but in that case storage not working, doesn't even create an entry in localstorage.

https://github.com/floinay/ngxs-labs-data-stackblitz

  1. Clone this repo and run project
  2. open localhost:4200
  3. Open inspect panel and go to the application tab
  4. Go to Local Storage page

In this app there is 2 persistence state, "test" in root module and "feature" in feature module, but in local storage exists only "test" data

Thanks

image

@splincode
Copy link
Member

@floinay yes, this is regression ((

@ishanuda
Copy link

ishanuda commented Apr 27, 2021

@floinay ,
I see few things that should be corrected according to the doc in your repo.

  1. set state - this.setState({featureKey1: 'test', key2: 'test1'}); should be this.ctx.setState({featureKey1: 'test', key2: 'test1'});
  2. @DataAction() should be used with the fetch(): void {} method

NOTE: DataAction can be imported from '@ngxs-labs/data/decorators';
Please try these settings.

regards.

@floinay
Copy link
Author

floinay commented Apr 27, 2021

@floinay ,
I see few things that should be corrected according to the doc in your repo.

  1. set state - this.setState({featureKey1: 'test', key2: 'test1'}); should be this.ctx.setState({featureKey1: 'test', key2: 'test1'});
  2. @DataAction() should be used with the fetch(): void {} method

NOTE: DataAction can be imported from '@ngxs-labs/data/decorators';
Please try these settings.

regards.

Hi, i tried, not working

@splincode
Copy link
Member

@floinay can you help me? create bugfix with PR?

@strigefleur
Copy link

Any updates? It's kinda problematic to use it without feature modules.

@splincode
Copy link
Member

Move to Angular-RU/angular-ru-sdk#862

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants