Closed frankcollins3 closed 11 months ago
@redux/toolkit
PROGRESS: 0 process in the click 000
it appears to be a float representing 3 zeros ? PROGRESS:number is typed as a number of 0 but upon client log the value is 000.
wonder if this is a bytes issue or other.
also changed PROGRESS = action.payload to be an incrementer: SET_PROGRESS: (state, action) => { state.PROGRESS = state.PROGRESS += action.payload},
[1:26pm]
kept the state like this typed -> PROGRESS:any. defined value -> PROGRESS: null; output: process in the click null00 SET_PROGRESS: (state, action) => { state.PROGRESS = state.PROGRESS += action.payload}, [1:59pm]
radix and parseInt() const newProgressValue = PROGRESS + parseInt(HYDRO_SCHEDULE.length, 10); [2:23pm]
using ['check', 'check', 'no'] // count of "check" as basis from which to SET_PROGRESS
this works during Yes instances of 'check' but because SET_STATE is based on count of checkChecker... ['false', 'false'] checkChecker still returns an int for every instance in the array which falsy returns length + 1 // this action causes an inaccurate count because a falsy value yields array.length which is what truthy is based on
const checkChecker = STATUS.map(STATUS => STATUS === 'check') const length = checkChecker.length const percentage = 100 / HYDRO_SCHEDULE.length dispatch(SET_PROGRESS(percentage * length))
[3:11pm]
attempting to do: update water cycling as Y|N with every click.
error: the yes updates one time correctly and continues to update to be 20
proposed approach: 0: SET_PROGRESS is redux state... first approach creates localState to separate concerns. also created a promise in hopes of having more async ability.