I have a set of pages that all follow a similar pattern of /{report}/{id} but where {report} is replaced with a concrete name for each page. We also have a singleton reportManager that used to be updated in the page's OnParameterSet
protected override async Task OnParametersSetAsync(){ if (reportManager.SelectedId != id) { reportManager.SelectedId = id; } var item = reportManager.SelectedItem;}Now this logic has been moved into a component that each of the pages uses. But the as the pages will make calls to reportManager.SelectedItem the component's OnParametersSetAsync needs to be called before the page's OnParametersSetAsync.
Is there any way to reorder this stuff or a better way to extract this logic to some common place.
I've thought about inheritance but in blazor components it is kinda ugly and a bit fiddly if you want the component your are inheriting to enclose the derived component.
I've also thought about creating some page that matches /{report}/{id} and then provides the correct component based on the {report} parameter, but then each time a page is added you then have to update this 'routing' page.
Otherwise I might have to rework the reportManager as it is a bit clunky