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.

Failed syncing nested fields with Strapi plugin

See original GitHub issue

Discussed in https://github.com/meilisearch/meilisearch/discussions/2388

<div type='discussions-op-text'>

Originally posted by pedrogaudencio May 11, 2022 Hi there!

I’m having an issue when I update a collection-type entry that is nested inside a component/single type/collection. Not sure if this case is already referenced but I couldn’t find it anywhere.

Example:

  1. Create an Author collection type entry -> Meilisearch plugin creates an Author document;
  2. Create an Article collection type entry, add an Author collection type field inside the repeatable component AuthorsList in the Article -> Meilisearch plugin creates an Article document with its nested fields;
  3. Update the Author entry -> Meilisearch plugin updates the Author document;
  4. Meilisearch plugin does not update the Author entry inside the nested fields in the Article document.

As a workaround, (in this example) I thought of creating an afterUpdate() lifecycle hook in the Author triggering the Article document update by calling the Meilisearch plugin controller. Is there a better way to do this? If not, is there an example to call the document update from the Meilisearch plugin?

Using:

Thank you! 😃</div>

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pedrogaudenciocommented, Jun 9, 2022

Those suggestions all seem very interesting. Do you know if there’s already something in place?

await meilisearch
  .updateEntriesInMeilisearch({
    contentType: "author",
    entries: [authors],
  })

This was kinda what I was aiming towards with my suggestion of triggering the parent document update by calling the Meilisearch plugin controller. As you say, this is possible using the hooks provided by Strapi and probably the cleanest solution at this point. Although it’s likely that the entry data won’t pass through transformEntry() when we bypass the plugin and call meilisearch.updateEntriesInMeilisearch()

0reactions
bidoubiwacommented, Jun 9, 2022

I think you can have access to transformEntry by using the strapi API like this:

strapi.config.get('plugin.meilisearch')
Read more comments on GitHub >

github_iconTop Results From Across the Web

[RESOLVED] Can't get the data from nested components ...
Consider a collection type, Page, which has two fields, a title of type text and sessions of type dynamic zone.
Read more >
strapi-plugin-navigation - npm
Start using strapi-plugin-navigation in your project by running `npm ... Flat; Tree (nested); RFR (ready for handling by Redux First Router) ...
Read more >
strapi-plugin-permalinks v0.1.7 - npm.io
✨ Features · Manage a chain of slugs to build a unique URL path · Nested relationships for content types · Child relations...
Read more >
Configuration
strapi.config.get('server.host', 'defaultValueIfUndefined');. Nested keys are accessible with dot-notation . NOTE. Notice that the filename is used as a ...
Read more >
Strapi - working with relationships and how to use Graphql for ...
Relationships, specially nested relationships are always going to come in projects. In this video, I am going to show you how you can...
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