nuxt-modules / nuxt-modules/strapi

Ability to send populate field on update request

Open
#292 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
717
Forks
89
Avg merge
7h 3m
Merged PRs (30d)
6

Description

I'm implementing a simple profile page, and when I update a collection entry, I don't receive its component field. When I first fetch the entry I pass populate as a parameter in the find request, but it's not possible to receive the updated entry with this field in the update response.

I think it would make sense to be able to pass parameters (as it's done in the find request) to other requests such as update.

I understand it's possible to just redo the find request to fetch the updated version of the entry, but its one more request then necessary.

Right now, you can "force" the populate information alongside the id information in the update request, as such:
const updateQuery = await update('profiles', profile.id+'?populate[0]=componentfield', formdata);
but this is a poor solution in my opinion.

The behavior I'm trying to implement is described rather well in this stackoverflow answer: https://stackoverflow.com/a/70640157/3503730

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by tracing the module's find and update request helpers and compare how query parameters are handled; done means an update request can accept populate parameters and return the updated entry with its populated component field without a second fetch.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.