Skip to content

Conversation

@cuquo
Copy link

@cuquo cuquo commented Apr 6, 2024

Description

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • Chore (non-breaking change which does not add functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Change to the templates directory (does not affect core functionality)
  • Change to the examples directory (does not affect core functionality)
  • This change requires a documentation update

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes
  • I have made corresponding changes to the documentation
@cuquo cuquo changed the base branch from main to alpha April 6, 2024 03:51
if (!originalDoc) return true

// if it's a nested collection, we should populate the breadcrumbs
if (data?.hierarchy && !Array.isArray(data?.hierarchy)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is data.hierarchy here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, it should take the value from the breadcrumbsFieldSlug from the config

own `parent` field to each collection manually. This gives you complete control over where you put the field in your
admin dashboard, etc. Set this property to the `name` of your custom field.

#### `urlFieldSlug`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a while as I reviewed this PR to understand fully what this new property is for. I am not sure I do, even now.

If we want to compare a new URL vs. an old URL, to determine if we need to recreate breadcrumbs, could we not do that by looking at the last breadcrumb in the array of breadcrumbs?

The generateURL function could be used to create the new URL, and then we use that newly created URL to compare against the breadcrumbs coming in from the previous doc. Right?

I would like to avoid having another property introduced into the config of this plugin.

Let me know what you think!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens right now, is that the nested-doc plugin will always be executed when something has change from a nested collection. It's not an issue with a low amount of items within a collection but when you have hundreds or thousand of its, it will run across all of them and their children.

Inside shouldPopulateBreadcrumbs we check if the collection key has changed or its new, there's also generateURL as an optional prop for the plugin, so we need to populate urlFieldSlug with the value it would take in order to also avoid doing the whole process if that value changes otherwise it will only not save when the collection key is different.

@github-actions
Copy link
Contributor

This PR is stale due to lack of activity.

To keep the PR open, please indicate that it is still relevant in a comment below.

@github-actions github-actions bot added the stale label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants