Skip to content

Wrong routing when component implements class based on ComponentBase #29

@dzambo2302

Description

@dzambo2302

Hello!
I'm trying to rewrite a legacy webforms app using Blazor server.
However, I'm having some problems with proxy routing.

Let's imagine ComponentBase class implementation such as this one:

public class CancellableComponent : ComponentBase, IDisposable
{
	internal CancellationTokenSource _cts = new();

	public void Dispose()
	{
		_cts.Cancel();
		_cts.Dispose();
	}
}

and the component that is implementing it

@page "/Settings"
@implements CancellableComponent
...

Then routing is strange, when I hit URL (for example https://localhost:5001/Settings) directly, it is not routed to Blazor page, but to the original webforms page. But when I click on its tab in the menu (Blazor part) it is routed correctly. Of course, when I remove @implements CancellableComponent from Blazor page, routing is correct in any circumstances.

How should I approach this situation, is there any chance of implementing my custom component base and having correct routing?
Many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions