Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url_alias localizations not saving relation #185

Open
aaronLejeune opened this issue Aug 21, 2024 · 4 comments
Open

url_alias localizations not saving relation #185

aaronLejeune opened this issue Aug 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@aaronLejeune
Copy link

Bug report

Hi there! Thanks a lot for this great plugin!
Since we've been scaling our app a bit, we're experiencing some strange reactions when generating localised links in collection types.

Context

When we create a new page in a collection type eg.: support, our urls gets generated nicely:
sceenshot admin panel:
image
screenshot database:
image

Bug

Problem is, the localised versions are not linked for some reason.
We get the data back like this: (using graphQL)

"url_alias": {
    "data": {
        "id": "508",
        "attributes": {
            "url_path": "/en/support/video-guides/",
            "locale": "en",
            "localizations": {
                "data": []
            }
        }
    }
}

when taking a look in the wt_url_alias_localizations_links table in our database, we can see that the ID references are not present. Sometimes, the relation is saved when we change slugs, delete an item , .... but then often, just one reference will be present.
image

We tried to "Bulk generate" the collections but while we received a Success: Successfully generated 4 URL aliases. - there were still no localizations present. This affected both local and production machines while the data is the same.

System

  • Node.js version: >=18.0.0 <=20.x.x
  • NPM version: >=6.0.0
  • Strapi version: 4.25.3
  • Plugin version: ^1.0.0-beta.13
  • Database: postgres
  • Operating system: Mac
@boazpoolman boazpoolman added bug Something isn't working Needs investigation This needs some diving in to before it can be worked on labels Aug 21, 2024
@aaronLejeune aaronLejeune changed the title url_alias localizations not saving relation to eachother url_alias localizations not saving relation Aug 21, 2024
@boazpoolman
Copy link
Member

I have confirmed this issue when creating/updating pages in the content manager.
The localizations were not properly saved, I've fixed this in PR #187.

Though @aaronLejeune, as you mention, you also don't have the correct localizations after bulk generating the URL aliases.
I can't seem to reproduce that side of the issue.
Whenever I bulk generate, all the localizations end up in the right place.

Is there anything I'm missing?

@boazpoolman boazpoolman removed the Needs investigation This needs some diving in to before it can be worked on label Aug 28, 2024
@aaronLejeune
Copy link
Author

@boazpoolman thank you for looking into it!

Indeed the correct localizations after bulk generation are no there as well.
When generating, all urls are made correct, meaning they are all parsed as they should eg.:
image

Its just that they seem to disconnect the localised version for some reason.
I need to mention that I am doing a "hacky" way of generating URL's. Eg.:

I have a single type shop overview page and a collection type shop pages where I have the following URL patterns:
image
image

the collection type shop pages have a one-way relation to shop overview page - which is exctually not supported by Strapi, but I am doing nevertheless. I do that so I can get the slug of the parent page. Maybe that can be the reason why these localisations are sometimes not saving.

I got a workaround by fetching localisations from the page itself, instead of going inside the url_alias object so Im good for now :)

@boazpoolman
Copy link
Member

Thanks for clarifying @aaronLejeune.

I can't imagine your single type relation would have any effect on the translations.
Is there any way you could provide some steps on how to reproduce this issue from a fresh Strapi install?

I would love to get this issue resolved!

@boazpoolman
Copy link
Member

I've released the fix I was talking about in v1.0.0-beta.14.
You could try that out to see if the issues are resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants