第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

NGRX 實(shí)體 updateOne 不工作:id undefined

NGRX 實(shí)體 updateOne 不工作:id undefined

素胚勾勒不出你 2023-03-10 13:59:26
我決定尋求幫助,我就是無法理解 NGRX 實(shí)體?。ù舜a最初由 NX 創(chuàng)建)。我遵循了 NGRX Entity 指南,我也看了很多教程視頻,但我仍然無法讓NGRX Entity updateOne工作。在下面收到此錯(cuò)誤 - 我可以毫無問題地將實(shí)體加載到商店中,并且這些可以很好地構(gòu)建我的 UI。我有一個(gè)實(shí)體按鈕集合,并希望在單擊時(shí)更新按鈕的存儲(chǔ)狀態(tài) - 僅此而已?。ㄈ魏蜗敕槭裁催@不起作用??)ERROR TypeError: Cannot read property 'id' of undefined    at http://localhost:4200/vendor.js:83815:26    at Array.filter (<anonymous>)    at updateManyMutably (http://localhost:4200/vendor.js:83811:27)    at updateOneMutably (http://localhost:4200/vendor.js:83801:16)    at Object.operation [as updateOne] (http://localhost:4200/vendor.js:83622:27)    at http://localhost:4200/main.js:1169:28    at http://localhost:4200/vendor.js:88532:26    at reducer (http://localhost:4200/main.js:1173:12)    at http://localhost:4200/vendor.js:87072:20    at combination (http://localhost:4200/vendor.js:86960:37) 這是我到目前為止的代碼:// stateexport interface QuickButton {    id: number;    isSelected: boolean;    title: string;    linkUrl: string;}// in componentthis.store.dispatch( actions.setQuickFilter( evt ) );// evt = {id: 1, isSelected: true, linkUrl: "", title: "Video"}// in actionsexport const setQuickFilter = createAction(  '[QuickBar] setQuickFilter',  props<{update: Update<QuickButton>}>());// in reducerexport const QUICKBAR_FEATURE_KEY = 'quickBar';export interface State extends EntityState<QuickButton> {  selectedId?: string | number; // which QuickBar record selected  loaded: boolean; // has the QuickBar list been loaded  error?: string | null; // last none error (if any)}export interface QuickBarPartialState {  readonly [QUICKBAR_FEATURE_KEY]: State;}export const quickBarAdapter: EntityAdapter<QuickButton> = createEntityAdapter<QuickButton>();export const initialState = quickBarAdapter.getInitialState({  // set initial required properties  loaded: false,});const quickBarReducer = createReducer(  initialState,
查看完整描述

2 回答

?
拉丁的傳說

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊

您錯(cuò)誤地調(diào)度了您的操作。

this.store.dispatch(actions.setQuickFilter(evt));

應(yīng)該

this.store.dispatch(actions.setQuickFilter({ update: evt }));


查看完整回答
反對(duì) 回復(fù) 2023-03-10
?
慕森王

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超3個(gè)贊

耶??!最后。這是一個(gè)真正的愚蠢錯(cuò)誤——因?yàn)椴焕斫鈱?shí)體。大量的反復(fù)試驗(yàn)和記錄來解決這個(gè)問題!

解決方案:更改組件中的調(diào)度調(diào)用:

this.store.dispatch( actions.setQuickFilter( {update: evt} } ) );

到:

this.store.dispatch( actions.setQuickFilter( {update: {id: evt.id, changes: evt} } ) );

現(xiàn)在,我所有訂閱的功能都可以使用按鈕中的更新值來控制它們自己的 UI 元素。最后!


查看完整回答
反對(duì) 回復(fù) 2023-03-10
  • 2 回答
  • 0 關(guān)注
  • 116 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)