ngxs

Pipe and Tap VS subscribe with ngxs

自闭症网瘾萝莉.ら 提交于 2021-02-18 10:16:06
问题 I am playing around with pipe and subscribe. If I am using pipe with tap, nothing will log in console. If I am using subscribe, it's working. So what I am doing wrong? import { Observable } from 'rxjs'; import { tap, take } from 'rxjs/operators'; this.store.select(state => state.auth.authUser).pipe( take(1), tap((data) => { //Not Working - no console output console.log('[Tap] User Data', data); }) ); this.store.select(state => state.auth.authUser).subscribe((data) => { // Working - user data

problem with performance ngxs and redux dev tools

☆樱花仙子☆ 提交于 2021-02-10 20:33:32
问题 I store a whole app in ngxs and this works fine. I have problem when I want to see these data in redux devtools. On first when store was small, all works fine, when store comes lager reduxdevtools works slower and slower, and now is crashes. Actual here is my json store it is no so big, but in feature with data from backend it will be have about 20-30 Mb on debug window I see these info: Application state or actions payloads are too large making Redux DevTools serialization slow and consuming

problem with performance ngxs and redux dev tools

心不动则不痛 提交于 2021-02-10 20:32:07
问题 I store a whole app in ngxs and this works fine. I have problem when I want to see these data in redux devtools. On first when store was small, all works fine, when store comes lager reduxdevtools works slower and slower, and now is crashes. Actual here is my json store it is no so big, but in feature with data from backend it will be have about 20-30 Mb on debug window I see these info: Application state or actions payloads are too large making Redux DevTools serialization slow and consuming

NGXS: How to test if an action was dispatched?

时间秒杀一切 提交于 2020-12-29 05:50:29
问题 How to unit test whether an action was dispatched? For example, in a LogoutService, I have this simple method: logout(username: string) { store.dispatch([new ResetStateAction(), new LogoutAction(username)]); } I need to write a unit test that verifies that the two actions are dispatched: it('should dispatch ResetState and Logout actions', function () { logoutService.logout(); // how to check the dispactched actions and their parameters? // expect(...) }); How can I check the dispatched

@Select of nested object and immutability of state

谁都会走 提交于 2020-12-15 05:41:11
问题 I am using NGXS for a while and found that if you use an object or array in @Select return it can break the immutability of the sate in the component. Example: state: AppStateModel = { justValue: true, complexObject: { a:1, b:2} } and then two selectors: // Here in a component we will get access to object by link and can modify it in state without patchState or setState @Selector() static getComplexObject(state: AppStateModel) { return state.complexObject; } // That will work fine since JS

Difference in performance between ngrx and ngxs?

眉间皱痕 提交于 2020-07-18 03:31:11
问题 I want to use ngxs for state management in my Angular 6 application. But I am not sure if it is mature for big projects. I can not find any articles about Difference in performance between ngrx and ngxs. Can someone provide some info about it? Performance metrics: Getting a large number of items form the store and writing back into the store. 回答1: Here is good answer from Reddit (Angular2+ community). It's from a developer who tested both and switched to NGXS. I would like to share my

Difference in performance between ngrx and ngxs?

给你一囗甜甜゛ 提交于 2020-07-18 03:31:10
问题 I want to use ngxs for state management in my Angular 6 application. But I am not sure if it is mature for big projects. I can not find any articles about Difference in performance between ngrx and ngxs. Can someone provide some info about it? Performance metrics: Getting a large number of items form the store and writing back into the store. 回答1: Here is good answer from Reddit (Angular2+ community). It's from a developer who tested both and switched to NGXS. I would like to share my

API requests returning errors trying to access NestJS backend from Angular frontend

隐身守侯 提交于 2020-04-17 22:57:11
问题 When making an API call to my NestJS app I'm receiving the following errors. core.js:6185 ERROR HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: " https://localhost:3333/api/product-index ", ok: false, …} and GET https://localhost:3333/api/product-index net::ERR_SSL_PROTOCOL_ERROR From looking into Nest, Angular and NGXS individually and the suggested ways to go about things I have everything set up properly. The only thing I could think to do was tinker

Opening modal using NGX and state management

左心房为你撑大大i 提交于 2020-02-21 06:33:52
问题 I'd like to use NGXS to open modal which will set column visibility for datatable. Here is my code: state.ts file: @Action(OpenColumnModal) openColumnModal(ctx: StateContext<FeedStateModel>) { const state = ctx.getState(); const allCols = state.allColumns; return this.modalService.openColumnVisibilityModal(allCols).pipe(tap((result) => { ctx.setState({ ...state, allColumns: result, userColumns: result.filter(col => col.visible) }); }) } modal.service.ts: openColumnVisibilityModal(columns):

Opening modal using NGX and state management

陌路散爱 提交于 2020-02-21 06:32:52
问题 I'd like to use NGXS to open modal which will set column visibility for datatable. Here is my code: state.ts file: @Action(OpenColumnModal) openColumnModal(ctx: StateContext<FeedStateModel>) { const state = ctx.getState(); const allCols = state.allColumns; return this.modalService.openColumnVisibilityModal(allCols).pipe(tap((result) => { ctx.setState({ ...state, allColumns: result, userColumns: result.filter(col => col.visible) }); }) } modal.service.ts: openColumnVisibilityModal(columns):