Repository navigation
Nl/add template list query - #227
Conversation
|
Correction, I can put the query in ParameterConfiguration if I use a useEffect to set the template but the component has this flickering effect when switching between techniques which doesn't look as nice. |
yousefmoazzam
left a comment
There was a problem hiding this comment.
Cool, it's nice to not rely on local hardcoded values for templates. This will also force us to make sure the templates are named appropriately so then they can be queried by ImagingHub.
I was curious about the comment about setting local state because I didn't understand what state was needed. It'd indeed be nice if the query could be made in ParameterConfiguration since the parent doesn't need that information. I tried something out in #229 that has the query made in ParameterConfiguration, could you take a look and see if that is doing something sensible, or if it's not addressing the state problem that was referred to?
|
Oh wow that was incredibly stupid of me. So I've been putting the query after the declaration of the template useState (that was the state I was on about). I'm used to checking the data variable is empty so that I can return an error. In that scenario, you can't put useStates after conditional returns, however, filter doesn't care if the input doesn't exist because it will just return an empty array so you can put the query before it SMH. Putting the query after the useState declaration and then using setTemplate causes an infinite rendering loop. |
02367ac to
bb1e5b3
Compare
Query workflow templates in param config component
This PR adds a query for retrieving the list of templates.
I was hoping to have the query in ParameterConfiguration but unfortunately React didn't like that (React doesn't seem to like setting a locally declared state, that being template, with freshly retrieved query data) so I had to move it up to ProcessingView.