mattie-strapi-bundle
mattie-strapi-bundle copied to clipboard
Add publication state handling to lifecycle methods
I'm proposing this change to make the plugin reactive to publication state. This means unpublished entities will not appear in the search index.
- Create: if the entity uses draft/publish and
publishedAt
isnull
then do not index; otherwise create in index - Update if the entity uses draft/publish and
publishedAt
isnull
then delete from index; otherwise update in index
The update behaviour isn't the smartest because the best solution would be to detect if publication state had actually changed; but I can't figure out how to do that so I'm defensively deleting to ensure the unpublished entity is removed from the search index.
Also, in theory we could be "updating" a non existent entity in the index where this entity is being published for the first time. I know Algolia handles this because partialUpdateObject
can create as well as update, but worth bearing in mind for future providers.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
Name | Status | Preview | Updated |
---|---|---|---|
mattie-strapi-bundle | ⬜️ Ignored (Inspect) | Aug 14, 2022 at 5:43PM (UTC) |
+1 to this feature. could you please merge it in @MattieBelt ?