road86 / bahis-desk

Desktop application for BAHIS2
GNU General Public License v3.0
2 stars 1 forks source link

Incorrect default location in forms for Rupsa in #30 #35

Closed mixmixmix closed 1 year ago

mixmixmix commented 1 year ago

Bug Description

In #30 in form Configuration->Staff->New Submission for rupsa is

Screenshot 2022-12-28 at 10 48 51

To Reproduce

  1. Log in as rupsa 22 load form Configuration->Staff->New Submission

Expected Behaviour

should be

Screenshot 2022-12-28 at 10 49 04

Additional Context

This is not a very big problem, can be however related to #34

ChasNelson1990 commented 1 year ago

I believe this is being caused by the React Warning in the console:

Warning: Cannot update a component (`Connect(App)`) while rendering a different component (`XXXX`). To locate the bad setState() call inside `XXXX`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render

Where XXXX is the different components that are not updating. Why this is a new issue I am not sure but I am looking into it.

ChasNelson1990 commented 1 year ago

This is actually deep in odkformrenderer and is a repeated antipattern that used to be a silent thing in react but has been a loud warning for a while. Essentially odkformrenderer uses class components but wraps everything inside the render function, including state changes... so it's trying to update central state whilst rendering (bonkers) and React can't allow this because it breaks hooks. So... we either need to rewrite odkformrenderer in proper React... or undo all the new, standard React in the app... or live with it for now?

ChasNelson1990 commented 1 year ago

This is the relevant issue: https://github.com/facebook/react/issues/18178#issuecomment-595846312 I think this might be a big problem for us...

ChasNelson1990 commented 1 year ago

This is upstream in odkformrenderer; as I think we need to rewrite odkformrenderer anyway we should discuss this

ChasNelson1990 commented 1 year ago

This is related to the changes we're making for v2.2.x where we become strict that all users must be an upazila (rupsa's account is a district or division). Will close with v2.2.x

ChasNelson1990 commented 1 year ago

Closes by #60