Skip to content

AsyncStorage loading errors when passing props in Menu #1

@ryanbuckleyca

Description

@ryanbuckleyca

props are loading bad values from local storage

error loading from local storage:
[TypeError: undefined is not an object (evaluating 'a.fields.Amount')]

not sure why calling SpentThisWeek(props.logs) would trigger local storage
calling TotalBudget(props.cats) also triggers local storage

hard passing a logs array of objects to SpentThisWeek([{...}, {...}, {...}] works fine
so there's something wrong with the state of props here

cannot seem to console logging during the state where that happens though.
logs are always array of objects as expected

export default function Menu(props:any) {
  let limit = .75
  if(props.cats && props.cats.length > 1 && props.logs && props.logs.length > 1) {
    console.log("props.logs in Menu: ", props.logs) // seems fine
    console.log("props.cats in Menu: ", props.cats) // also logs as expected
    limit = TotalBudget(props.cats) // <--------- this is where the error begins!
    console.log("totalBudget: ", limit)
  }
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions