Skip to content

edit-fk-multi CDR loads all FK candidates in ngOnInit even when the column is read-onlyΒ #526

Open

Description

@jd-igf

Is this a regression?

No

Severity

🟑 Minor – small but noticeable issue

Please provide the branch(es) you discovered this issue in

v100

Environment Details

Edge 156 on Windows 11, 10.1

Please provide a minimal set of steps to reproduce the issue

  1. Open any detail page / form that renders a multi foreign key column via imx-edit-fk-multi where the current user has no write permission on the column (columnContainer.canEdit === false).
  2. Open the browser dev tools β†’ Network tab.
  3. Observe that on component initialization a request for the candidate collection of fkRelations[0] is sent with PageSize=-1.

Description

In edit-fk-multi.component.ts (imxweb/projects/qbm/src/lib/cdr/edit-fk/edit-fk-multi.component.ts) the candidate collection of the FK relation is loaded unconditionally in ngOnInit():

public async ngOnInit(): Promise<void> {
  if (!this.columnContainer.fkRelations?.length) {
    return;
  }
  this.loading = true;
  try {
    const candidateCollection = await this.columnContainer.fkRelations[0]?.Get({ PageSize: -1 });
    this.isHierarchical = candidateCollection?.Hierarchy != null;
  } finally {
    this.loading = false;
  }
}

editAssignment() can only be triggered when the column is editable.

For read-only columns this results in:

  • an unnecessary server round trip with PageSize: -1 for every rendered multi-FK CDR,
  • the component being in loading state although nothing is needed from the server,

The single-value counterpart edit-fk.component.ts (same folder) already handles this correctly. There, ngOnInit() delegates to initCandidates(), which is guarded by the edit permission and only loads a small page instead of the full collection

Describe what you expected to happen versus what actually happened

Expected:
EditFkMultiComponent behaves like EditFkComponent: the candidate collection is only requested when columnContainer.canEdit is true, since isHierarchical is only needed for the picker side sheet.

Actual:
The full candidate collection is loaded on every initialization of EditFkMultiComponent regardless of the edit permission, while EditFkComponent correctly skips the request.

Relevant logs or console output

Add a screenshot(s) if that helps illustrate the problem

No response

Suggested Fix

Apply the same canEdit guard that EditFkComponent.initCandidates() already uses:

public async ngOnInit(): Promise<void> {
  if (!this.columnContainer.fkRelations?.length) {
    return;
  }
  if (this.columnContainer && this.columnContainer.canEdit) {
    this.loading = true;
    try {
      const candidateCollection = await this.columnContainer.fkRelations[0]?.Get({ PageSize: -1 });
      this.isHierarchical = candidateCollection?.Hierarchy != null;
    } finally {
      this.loading = false;
    }
  }
}

Anything else?

No response

Before submitting...

  • I have searched for existing issues that match this one on github and on the community support page
  • I have included all necessary details to reproduce this issue

Activity

  1. added
    bug
    on Oct 29, 2026
  2. github-actions commented on Nov 28, 2026

    @github-actions

    This issue has not seen any action for a while! Closing for now, but it can be reopened at a later date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugno-issue-activity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions