Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Id field is hardcoded in model change event #6401

Closed
marciogurka opened this issue Mar 17, 2023 · 2 comments
Closed

Id field is hardcoded in model change event #6401

marciogurka opened this issue Mar 17, 2023 · 2 comments
Labels
bug Something isn't working forum Issues from forum info requested Further information is requested large-account Reported by large customer OEM OEM customer premium

Comments

@marciogurka
Copy link

Forum post

"Hi,

We are encountering some strange behaviour when we are assigning new ids to records in our tree grid. It seems that the root cause of this problem is the onModelChange handler in Store.js assumes the id fields is called id. In our implementation, we set Model.idField to be something different.

See this code snippet from onModelChange:

if ('id' in wasSet) {
  const { oldValue, value } = toSet.id;

  me.updateDependentRecordIds(oldValue, value);

  me.onRecordIdChange({ record, oldValue, value });
}

Should this be something like this, instead?

if (record.idField in wasSet) {
  const { oldValue, value } = toSet[record.idField];

  me.updateDependentRecordIds(oldValue, value);

  me.onRecordIdChange({ record, oldValue, value });
}

If we call onRecordIdChange manually when we assign the new id, everything works fine."

@marciogurka marciogurka added bug Something isn't working premium forum Issues from forum large-account Reported by large customer OEM OEM customer labels Mar 17, 2023
@isglass isglass added the high-priority Urgent to have fixed label Mar 17, 2023
@matsbryntse matsbryntse self-assigned this Mar 19, 2023
@matsbryntse matsbryntse added the ready for review Issue is fixed, the pull request is being reviewed label Mar 19, 2023
@matsbryntse
Copy link
Member

Test added to 6401-id branch

@matsbryntse matsbryntse removed their assignment Mar 20, 2023
@matsbryntse matsbryntse removed the ready for review Issue is fixed, the pull request is being reviewed label Mar 20, 2023
@isglass isglass self-assigned this Mar 21, 2023
@isglass isglass removed their assignment Mar 21, 2023
@isglass isglass added info requested Further information is requested and removed in progress high-priority Urgent to have fixed labels Mar 21, 2023
@isglass
Copy link
Contributor

isglass commented Mar 21, 2023

Requested more info on the forum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum info requested Further information is requested large-account Reported by large customer OEM OEM customer premium
Projects
None yet
Development

No branches or pull requests

3 participants