question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relationship values may be saved with the wrong order

See original GitHub issue

Following on from #1359, and @mitchellhamilton’s comment regarding this API suggestion from @jesstelford:

return {
  disconnectAll: true,
  connect: ids.map(id => ({ id })),
};

Just tried that and it changes the order of the items which would probably be really confusing for users

Since that API is currently our recommended way of “setting” the value of a relationship field, we should ensure it works as expected and saves the items in the given order

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
willmatoscommented, Mar 6, 2020

Have any decisions been made on this? I have a scenario where I am trying to create a Playlist. In this scenario the order is everything.

0reactions
jhohlfeldcommented, Jun 6, 2022

Hi, I landed at this issue after initially setting up keystone and going through the getting started tutorial. After some instant success I am now stuck on exactly this issue.

This thread (https://stackoverflow.com/questions/66034621/keystonejs-user-defined-order-for-relationship) talks about using another intermediate list: make a list to describe the sorting order of the relation between two other lists (many to many). This however feels awkward and I would like to ask if this is still the only way to get sorting order within relationships?

I would prefer not to add a hook or some hacky SQL to reach my goal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Know If Your Relationship Is Worth Saving
If you both believe the relationship is worth saving, then you'll equally put in the work. Communication is the foundation of every relationship ......
Read more >
How to save a relationship and also know when to let go
Although optimism always gets a gold star, the truth is that not all relationships are meant to be saved. Before deciding how you'll...
Read more >
10 Core Values of a Lasting Relationship - Lifehack
Similar core beliefs are fundamental for you and your partner in order to feel safe, protected, connected, and comfortable, to name but a...
Read more >
11 Core Relationship Values Every Couple Must Have
For example, marriage core values, such as respect and forgiveness, when shared among partners, can be of immense help in conflict management.
Read more >
How to Avoid the Pursuer-Distancer Pattern in Your Relationship
Dr. Lerner points out the importance of recognizing that neither pattern is wrong. In a normal relationship, we may actually take turns adopting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found