I am using Mobx with React (typescript) to get some data from firebase and display it. at the first render no data is rendered on the screen till I change for instance tabs in view that the component get re-rendered.
the component class:
interface Props {id: string; mytore?: MyStore;} @inject('mystore') @observer export class myClass extends Component<Props>{ constructor(props: Props) {super(props);} componentDidMount() { this.props.mystore!.getBs(this.props.id);} render() { const { arrB } = this.props.mystore!; return ( <div>{arrB.map((e) => (<h3 key={`${e.id}`}>{e.name}</h3>))}</div> ); } }the store class
export class MyStore{ @observable arrA=[]; @observable arrB=[]; constructor(){this.loadAllAs()} @action.bound loadAllAs(){runInAction(async()=>(this.arrA=await /*fetchfunction*/))} @action getBs(id){this.arrB=arrA.filter(/*some logic*/)} }so here the
arrBgets manipulated after calling the method, and it is an observable which get destructures at render method of the component so I was expecting any changes to thearrBresult in a re-render but nothing happens till regarding other actionscomponentDidMountgets called.