Updating props before binded
In this project, form controls have permissions that are received from call to an API endpoint.
I have somewhat gotten this concept right, however, the permission only seems to be applied on a re-render.
A "screen-key" is sent to the backend, the backend returns with an array of screen-keys (for form controls) and applies related permissions (AKA availability). Eg. disable, readonly, hidden, etc.
I have a custom form component that takes a screen-key as a prop. If this screen key exists, it fetches the data from the backend and stores it in a hashmap. The form component uses "provide" to provide it's own screenkey to any child form control components.
Using "inject", a form control gets the parent's screenkey and, along with its own screenkey via props, queries a pinia store for its availability. This availability is returned, ammended to props (
The problem, however, is that while this does work, it does not work on the first render. It seems that it needs to be re-rendered for it to take effect and I'm not sure how to fix this.
I have somewhat gotten this concept right, however, the permission only seems to be applied on a re-render.
A "screen-key" is sent to the backend, the backend returns with an array of screen-keys (for form controls) and applies related permissions (AKA availability). Eg. disable, readonly, hidden, etc.
I have a custom form component that takes a screen-key as a prop. If this screen key exists, it fetches the data from the backend and stores it in a hashmap. The form component uses "provide" to provide it's own screenkey to any child form control components.
Using "inject", a form control gets the parent's screenkey and, along with its own screenkey via props, queries a pinia store for its availability. This availability is returned, ammended to props (
amendedProps = {...props, ...availability}) to which this is v-binded to the form control. (I have also tried using computed)The problem, however, is that while this does work, it does not work on the first render. It seems that it needs to be re-rendered for it to take effect and I'm not sure how to fix this.
