Skip to content

Nl/add template list query - #227

Merged
yousefmoazzam merged 9 commits into
mainfrom
nl/add-template-list-query
Oct 15, 2026
Merged

yousefmoazzam merged 9 commits into
mainfrom
nl/add-template-list-query

Conversation

@NatLeung96

Copy link
Copy Markdown
Collaborator

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.

@NatLeung96

Copy link
Copy Markdown
Collaborator Author

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 yousefmoazzam left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@NatLeung96

NatLeung96 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

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.

@NatLeung96
NatLeung96 force-pushed the nl/add-template-list-query branch 2 times, most recently from 02367ac to bb1e5b3 Compare October 15, 2026 13:04
@yousefmoazzam
yousefmoazzam merged commit e5a6ce0 into main Oct 15, 2026
1 check passed
@yousefmoazzam
yousefmoazzam deleted the nl/add-template-list-query branch October 15, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants