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

Updates clear all the item entity relationship fields #265

Closed
ikx94 opened this issue Jan 15, 2025 · 0 comments · Fixed by #267
Closed

Updates clear all the item entity relationship fields #265

ikx94 opened this issue Jan 15, 2025 · 0 comments · Fixed by #267
Labels
bug Something isn't working

Comments

@ikx94
Copy link

ikx94 commented Jan 15, 2025

Describe the bug
When you do an update to an entity, either via SDK or REST API, all of its belongsTo fields get emptied.

To Reproduce
Steps to reproduce the behavior:

For example, when having these 2 entities:

SignType:
  seedCount: 5
  namePlural: Sign Types
  mainProp: name
  properties:
    - { name: name, type: text, validation: { isNotEmpty: true } }

Sign:
  seedCount: 3
  mainProp: friendlyName
  properties:
    - { name: friendlyName, type: text }
    - { name: fabricationDate, type: date }
    - {
        name: photo,
        type: image,
        options:
          {
            sizes:
              {
                small: { width: 500, height: 500 },
                large: { width: 1920, height: 1080 },
              },
          },
      }
  belongsTo:
    - { name: signType, entity: SignType, eager: true }

If a Sign has a signType, and you then do .update or update it through REST API, then that value will be cleared. Same thing happens if it has other relationships.

I've tried with eager set to false, and with set to true, and it still happens.

So currently from the frontend I need to add all of the related fields and add them as hidden inputs and send them in my form data.

Expected behavior
Since it's an update, no values should be cleared, unless they are sent and set to "" or null.

@brunobuddy brunobuddy added the bug Something isn't working label Jan 15, 2025
brunobuddy added a commit that referenced this issue Jan 20, 2025
@brunobuddy brunobuddy linked a pull request Jan 20, 2025 that will close this issue
8 tasks
@brunobuddy brunobuddy mentioned this issue Jan 20, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants