ButtonType.Link - href not rendered when there's a custom attribute and an HTTP call

Abierto
#1,174 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
csharp
Área
frontend

Línea de trabajo

Start at the Blazor Button component that renders ButtonType.Link, then trace how it combines the To parameter with unmatched custom attributes during rendering. Reproduce the reported behavior with the supplied component and HTTP call, comparing it with the cases where either the custom attribute or the call is removed. Done means the rendered link retains the expected href in the reported scenario.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Describe the bug

When the following is rendered, the <a> tag doesn't have an href attribute:

@page "/counter"
@using BlazorBootstrap
@inject HttpClient HttpClient;

<Button Type="@ButtonType.Link" To="/my-route" moo="moo">Moo</Button>

@code {
    protected override async Task OnInitializedAsync()
    {
        await HttpClient.GetStringAsync("https://jsonplaceholder.typicode.com/posts/1");
    }
}

If I remove the custom moo attribute or comment out the HttpClient call in OnInitializedAsync, then the button/link is rendered properly.

To Reproduce
Steps to reproduce the behavior:

  1. Add a Button with Type=ButtonType.Link and a URL for To and a custom HTML attribute
  2. Add an HttpClient call in OnInitializedAsync()
  3. Render the page

Expected behavior
Clicking the button should redirect to the URL specified in the To property.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • .NET Version: .NET 9
  • BlazorBootstrap: 3.4.0
  • Blazor WebAssembly / Server: WebAssembly
  • Blazor Interactive Render Mode: Auto
  • Blazor Interactivity Location: Per page/component

Sample code
See above

GitHub repo
GitHub repo with minimal code to reproduce the issue.

Desktop (please complete the following information):

  • OS: macOS, Windows
  • Browser: Chrome
  • Version: 140.0.7339.80

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Lenguaje dominante
HTML
Estrellas
1.2k
Forks
111
Merge medio
4 min
PR fusionados (30 d)
55

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vikramlearning/blazorbootstrap

Todos los issues de vikramlearning/blazorbootstrap

Issues similares

Más issues de Web Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.