keystone-5 icon indicating copy to clipboard operation
keystone-5 copied to clipboard

Can’t get To-single relationship field ID in labelResolver

Open rodshtein opened this issue 5 years ago • 9 comments

Describe

Wen I use a To-single relationship Field with Many option and then tried to get it ID's in labelResolver it comes only once.

All other fields ID or values came but the Field ID comes only once.

Without option Many all ok.

Bug

console.log(item) right in labelResolver

image

Fields conf

image image

rodshtein avatar May 28 '20 00:05 rodshtein

Is Clinic_position a valid ref? Not Clinic.position?

Vultraz avatar May 28 '20 06:05 Vultraz

Yes, look at the first image, this field is correctly displayed when creating the first record.

If many option is false - all fine.

On 28 May 2020, at 4:42 PM, Charles Dang [email protected] wrote:

 Is Clinic_position a valid ref? Not Clinic.position?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

rodshtein avatar May 28 '20 07:05 rodshtein

And which list has the labelResolver?

Vultraz avatar May 29 '20 06:05 Vultraz

Full list module (simplified code)

module.exports = function (){
  return { 
    fields: {
     // That trouble field 
      positions: { 
        type: Relationship,
        many: true,
        ref: 'Clinic_position', 
      },
      clinic: { 
        type: Relationship,
        ref: 'Clinic.staff', 
      },
      doctor: {
        type: Relationship,
        ref: 'Doctor.employer', 
      },
    },
    labelResolver: async (item) => {
        console.log(item)
    }
  }
}

rodshtein avatar May 29 '20 07:05 rodshtein

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

stale[bot] avatar Sep 27 '20 12:09 stale[bot]

I'm experiencing the same issue- indeed, Relationship fields many: true will not be passed into the labelResolver function.

MichaelZaporozhets avatar Feb 26 '21 06:02 MichaelZaporozhets

@MichaelZaporozhets

For now, you can achieve it by the custom handler function

rodshtein avatar Feb 26 '21 06:02 rodshtein

@zamkevich Cheers- yeah, I worked around the issue; but it's still a bug that should be looked at :)

MichaelZaporozhets avatar Feb 26 '21 06:02 MichaelZaporozhets

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

stale[bot] avatar Jun 28 '21 11:06 stale[bot]