akita: Cannot assign to read only property 'currentPage' of object '[object Object]'
I’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Current behavior
this.paginatorRef.nextPage();
this.paginatorRef.setFirstPage()
The 2 preceding calls results in:
Cannot assign to read only property 'currentPage' of object '[object Object]'
Expected behavior
this.paginatorRef.nextPage();
this.paginatorRef.setFirstPage()
The 2 preceding calls results in the desired page being set in the paginator and the observable with proper data being emitted.
Minimal reproduction of the problem with instructions
Given:
export const COMMENTS_PAGINATOR = new InjectionToken('COMMENTS_PAGINATOR', { providedIn: 'root', factory: () => { const commentsQuery = inject(CommentsQuery); return new PaginatorPlugin(commentsQuery).withControls().withRange(); } });
In my component’s constructor…
constructor( @Inject(COMMENTS_PAGINATOR) public paginatorRef: PaginatorPlugin<CommentsState>,
if anywhere in my component I call these:
this.paginatorRef.nextPage();
this.paginatorRef.setFirstPage()
The 2 preceding calls results in:
Cannot assign to read only property 'currentPage' of object '[object Object]'
What is the motivation / use case for changing the behavior?
Just want to set the page or go to the next page
Environment
all
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20
I’m closing the issue. If some third party mutates the state, and you still want to use a store, you should disable
deepFreeze, as we discussed here.