Unable to search Internal links from RichText link dialog

default discord avatar
jakehopking
4 weeks ago
40

When I begin to search within the internal document select field, it immediately returns a red 'an error has occurred' message.



Here's a link to a screen recording of the event, and the error printed to the console:


https://www.dropbox.com/s/ba45mx22plaqv2g/Screen%20Recording%202023-04-24%20at%2020.10.33.mov?dl=0


It appears to be associated with my orders collection, but I've not seen this error before updating to 1.7.1.



@dribbens Could this also be related to localisation? I see there query includes

en

locale



Request URL: http://10.0.1.236:3000/payload/orders?where%5Band%5D%5B1%5D%5Borders%5D%5Blike%5D=h&limit=10&page=1&sort=orders&locale=en&depth=0
Request Method: GET
Status Code: 400 Bad Request

GET http://10.0.1.236:3000/payload/orders?where%5Band%5D%5B1%5D%5Borders%5D%5Blike%5D=h&limit=10&page=1&sort=orders&locale=en&depth=0 400 (Bad Request)
  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    Out of office, will touch in when I can

  • default discord avatar
    jakehopking
    4 weeks ago

    super reaction?! Didn't mean to send that!



    @payloadcms devs — Is there a way to specify which collections populate the RIchText field links?



    i.e. I don't need orders/customers etc to populate this select field.

  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    @jakehopking is

    &sort=orders

    correct in your query? That seems odd. Do you have a field named orders on your orders collection?


    Is there a way to specify which collections populate the RichText field links?

    Look at enableRichTextRelationship:

    https://payloadcms.com/docs/configuration/collections#admin-options
  • default discord avatar
    jakehopking
    4 weeks ago

    That's not my query. It's coming from the select in richtext link dialog.



    Thanks for the point for

    enableRichTextRelationship

    however it doesn't appear to work... anything else I need to do disable these?



    const Order: CollectionConfig = {
      slug: 'orders',
      admin: {
        useAsTitle: 'orders',
        defaultColumns: [
          'id',
          'customerRelationship',
          'status',
          'products',
          'createdAt',
          'customer',
          'payment',
          'tracking',
          'stripe',
          'dates',
        ],
        enableRichTextRelationship: false,
      },


    this correct place to add it, right?

  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    LGTM



    Let me try and replicate.

  • default discord avatar
    jakehopking
    4 weeks ago

    They still appear in the select

    Screenshot_2023-04-25_at_16.03.38.png
  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    What version of Payload? You're up to date?

  • default discord avatar
    jakehopking
    4 weeks ago

    I've added the same to customers and as you can see not working either



    im on 1.7.1

  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    Just give me a minute, I'm spinning up my env to test in.

  • default discord avatar
    jakehopking
    4 weeks ago

    k - thanks 👍

  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    I recreated

    enableRichTextRelationship

    not working. Now how do I recreate the issue where it queries? You see that request in the network tab from the edit screen on a collection with the RichText field?

  • default discord avatar
    jakehopking
    4 weeks ago

    yeah that's right - in the network tab



    it also prints to the console



    in browser

  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    I didn't get that, but my field isn't localized, so I will try that next.

  • default discord avatar
    jakehopking
    4 weeks ago

    mine isn't localised either...



    but yeah, the locale is in the query... is why I thought it might linked to our previous issue





    this occurs when any character is entered into the input

    Screenshot_2023-04-25_at_16.14.45.png
  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    I lead you astray. The richtext link is different from relationship.



    enableRichTextRelationship has nothing to do with links, sorry for that confusion.



    I think we need an extra feature to make rich text links follow the same pattern as relationship, either with the same property or a new one.

  • default discord avatar
    jakehopking
    4 weeks ago

    Oh I see - so at this stage there is no way to disable collections from appearing in this RichText link select drop down?



    any idea idea after looking into why the orders collection might be causing this to break?

  • discord user avatar
    dribbens
    Payload Team
    4 weeks ago

    This PR is related to what you want to customize, but I think the level of abstraction is not ideal for what you want to do.



    https://github.com/payloadcms/payload/pull/2559/files


    I would open a feature request on github for enableRichTextLink as a collection admin property.



    And we can decide how to prioritize it. Also an issue could be made for the link network error you're seeing. I wasn't able to reproduce it quickly.



    You seem to hit all the pain points, man! I don't know why that is.

  • default discord avatar
    jakehopking
    4 weeks ago

    Ok - so at this time, I'm stuck with a broken RichText link component — is that right? There's no solution at this stage? I need to open a feature request to get this fixed?

  • discord user avatar
    Jarrod
    Payload Team
    4 weeks ago

    @jakehopking Dan stated that an issue for the broken rich text link should be opened on GitHub.



    The feature request comment is in related to your need to limit which relationships are available when creating a link.

  • default discord avatar
    jakehopking
    4 weeks ago

    Thanks for the clarification 👍

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.