aws-amplify / aws-amplify/amplify-studio

using a form with relationship field causes unexpected behaviours on update form

Open
#936 0 comments 0 reactions 0 assignees View on GitHub
bug studio-ui ui-forms
Dominant language
No language data
Stars
135
Forks
32
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-adminui/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-adminui/blob/main/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d12tfj613dbsej

### Region

us-east-1

### Environment name

staging

### Figma File Version (if applicable)

_No response_

### Amplify CLI Version

_No response_

### If applicable, what version of Node.js are you using?

_No response_

### What operating system are you using?

_No response_

### Browser type?

_No response_

### Describe the bug

using the following schema
```
type User @model @auth(rules: [{allow: public}]) {
id: ID!
name: String
team: String
Notes: [Note] @hasMany(indexName: "byUser", fields: ["id"])
}

type Note @model @auth(rules: [{allow: public}]) {
id: ID!
information: String
category: String
userID: ID! @index(name: "byUser")
}
```
causes the update form to behave the following

https://github.com/aws-amplify/amplify-studio/assets/87995712/0bac5da8-f26e-4c4a-b156-36091ea37a31

creating a record in data manager causes the following on the form
![image (7)](https://github.com/aws-amplify/amplify-studio/assets/87995712/0da51b1c-02b3-4ed1-9124-eb27329703fc)

### Expected behavior

show an error on update form. update from should work

### Reproduction steps

1. create a model with relationship
2. enable relationships on forms in settings
3. use the note update form to test the form
4. observe the behaviour

### Project Identifier

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided User and Note schema, relationship-enabled forms, and the Note update form, following the listed steps. Compare the observed behavior with the expected error and successful update; done means the form reports the relationship-related problem clearly and updates the record correctly.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.