You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/09 09:33:26 UTC

[I] Repeat section's remove button is never disabled: ngFor shadows the field it reads [texera]

aglinxinyuan opened a new issue, #7431:
URL: https://github.com/apache/texera/issues/7431

   ### Describe the bug
   
   In `repeat-dnd.component.html` the per-row remove button is meant to be disabled when the field is read-only, but the guard never takes effect: the `*ngFor` shadows the name it reads.
   
   ```html
   <div *ngFor="let field of field.fieldGroup; let i = index" cdkDrag class="dnd-row">
     ...
     <button
       (click)="remove(i)"
       class="dnd-remove-button"
       [disabled]="field.templateOptions?.disabled">   <!-- `field` here is the ROW, not the section -->
   ```
   
   Inside the loop, `field` is the loop variable — one entry of `field.fieldGroup` — not the component's own `field`. Sub-fields carry no `templateOptions.disabled`, so the expression is always `undefined` and the button is never disabled.
   
   The add button, which sits **outside** the loop, reads the same expression correctly and does disable.
   
   ### To Reproduce
   
   Render `FormlyRepeatDndComponent` with `field.templateOptions.disabled = true` and inspect the two buttons:
   
   | Button | In the `*ngFor`? | Rendered |
   |---|---|---|
   | add | no | `disabled="true"` |
   | remove (each row) | yes | no `disabled` attribute |
   
   Confirmed in a spec run against `main`: the add button renders `disabled="true"` while the remove buttons render no disabled attribute at all with the identical binding.
   
   ### Expected behavior
   
   A read-only repeat section should not offer per-row removal. Both buttons should be disabled together.
   
   ### Suggested fix
   
   Rename the loop variable so it stops shadowing, e.g.:
   
   ```html
   <div *ngFor="let row of field.fieldGroup; let i = index" cdkDrag class="dnd-row">
   ```
   
   and leave the `[disabled]="field.templateOptions?.disabled"` bindings pointing at the section's field. The inner `formly-field` binding would become `[field]="subField"` off `row.fieldGroup` accordingly.
   
   ### Additional context
   
   Found while adding rendering tests for this component (the spec previously exercised only `onDrop` and never rendered). Those tests deliberately assert the add button's gating and **not** the remove buttons', so that the current behaviour is not cemented before this is fixed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Repeat section's remove button is never disabled: ngFor shadows the field it reads [texera]

Posted by "xuang7 (via GitHub)" <gi...@apache.org>.
xuang7 closed issue #7431: Repeat section's remove button is never disabled: ngFor shadows the field it reads
URL: https://github.com/apache/texera/issues/7431


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Repeat section's remove button is never disabled: ngFor shadows the field it reads [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #7431:
URL: https://github.com/apache/texera/issues/7431#issuecomment-5230825942

   <!-- texera:template-compliance -->
   👋 Thanks for opening this issue, @aglinxinyuan!
   
   It looks like the issue description doesn't quite follow our template yet:
   
   - The **What happened?** section is missing; please keep the template's headings.
   - The **How to reproduce?** section is missing; please keep the template's headings.
   - The **Version/Branch** section is missing; please keep the template's headings.
   
   Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
   
   You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Repeat section's remove button is never disabled: ngFor shadows the field it reads [texera]

Posted by "anthonychengit (via GitHub)" <gi...@apache.org>.
anthonychengit commented on issue #7431:
URL: https://github.com/apache/texera/issues/7431#issuecomment-5429114209

   /take


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org