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

Fix for bug #18129 #18137

Open
wants to merge 1 commit into
base: contrib
Choose a base branch
from
Open

Fix for bug #18129 #18137

wants to merge 1 commit into from

Conversation

yiangos
Copy link

@yiangos yiangos commented Jan 27, 2025

Change base class of ContentFinderByUrlAndTemplate to ContentFinderByUrlNew and update deprecated services

Prerequisites

  • I have added steps to test this contribution in the description below

This fixes #18129

Description

  • I changed the base class of ContentFinderByUrlAndTemplate to ContentFinderByUrlNew.
  • I removed dependency from IFileService
  • I added dependency from ITemplateService
  • I changed the code that fetches the ITemplate of the alternate template to use ITemplateService.GetAsync
  • Minor code changes to get the compiler to run (added "async" in the function definition, changed all the return statements to boolean instead of Task.Complete)

Copy link

github-actions bot commented Jan 27, 2025

Hi there @yiangos, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@yiangos
Copy link
Author

yiangos commented Jan 27, 2025

I don't understand, how can I fix the errors in the build? the project builds without any issues on VS 2022...

@nul800sebastiaan
Copy link
Member

Just leaving a note here that changing the signature of public methods results in breaking changes for anyone using Umbraco that has consumed any of those methods, that's what the build errors seem to point at. Usually we deal with that by providing overloads for the existing methods while pointing the original public methods to the new overload. I haven't looked at the code, so I don't know if this is a viable option here.

@yiangos
Copy link
Author

yiangos commented Jan 27, 2025

But I didn't change any public methods...

@emmagarland
Copy link
Contributor

Hi @yiangos

Just noticed this in the nuget.config:

<add key="myLocalFeed" value="Build.Out" />

Thanks
Emma

@nul800sebastiaan
Copy link
Member

nul800sebastiaan commented Jan 30, 2025

But I didn't change any public methods...

Sorry, had to run the other day so I left a quick comment with what I learned from the build errors.

The public method TryFindContent has had it's signature changed, so it seems like people who are already using that method will now have a problem when they need to run their site against the new code.

Additionally, the ContentFinderByUrlAndTemplate inheritance has changed, which might change the behavior of the method drastically (I don't know if that's the case, but I fear it will be). This means that people upgrading to a new version of Umbraco will start seeing different behavior and it might even break some of their previously working URLs and hurt their SEO.

So I would like to take a step back here first and ask: what is it that you're trying to accomplish here? To me, it reads like you wanted to refactor something to make Umbraco better. Which is nice, but we usually discourage that kind of thing because there could be a good reason behind the fact that the CMS team hasn't refactored this part yet.

My question then is: was there another reason you wanted to change this code? Maybe we can help you find a way that doesn't produce breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ContentFinderByUrlAndTemplate uses deprecated methods and the wrong base class
3 participants