Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
vaadin-dialog components not rerendering when properties change

I'm using a vaadin-dialog in my Web Components app. I would like the components inside to render on properties change but they don't.

I have a couple properties in my web component:

  static get properties() {
    return {
      title: { type: String },
      username: { type: String },
      signUpOpened: { type: Boolean },
    };
  }

The dialog is defined as such. I use a function to bind it to the DialogRenderer. The dialog shouldn't be always open, so the user clicks it to open it.

  render() {
    return html`
      <main>
        <h1>${this.title}</h1>

        <vaadin-dialog
          header-title="SignUp"
          .opened="${this.signUpOpened}"
          @opened-changed="${e => (this.signUpOpened = e.detail.value)}"
          ${dialogRenderer(this.signUpRenderer)}
          id="signUp">

        </vaadin-dialog>
      </main>

    `;
  }

  signUpRenderer() {
    return html`
        <vaadin-text-field value="${this.username}" @change="${(e) => {
          this.username = e.target.value
        }}" label="email"></vaadin-text-field>

        <vaadin-text-field value="${this.username}" }}" label="email-copy"></vaadin-text-field>
        <p>${this.username}</p>

    `;
  }

You can try the demo over here, the source code is here.

When changing the value of the text field, you can see that the other text field and the paragraph don't update.

Can you folks direct me towards what is going on?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The dialogRenderer directive that you are using to render the contents of the dialog needs to know whether the data used in the rendering has changed in order to determine whether it should rerender the contents or not. For that purpose the directive has a second parameter that allows you to pass in an array of dependencies that will be checked for changes. In your example, you should apply the directive like so, in order for it to re-render when the username changes:

<vaadin-dialog
  ...
  ${dialogRenderer(this.signUpRenderer, [this.username])}>
</vaadin-dialog>

This is explained in the directive's JSdoc, unfortunately the directives do not show up in the component's API docs at the moment. You could open an issue here and request to improve the component documentation to add a section that explains how the directives work.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda