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

Get page routes from the route index #739

Merged
merged 5 commits into from
Dec 8, 2022

Conversation

caendesilva
Copy link
Member

I think there's no point in creating a bunch of new objects each time we want to access a route, however since only pages with actual source files generally get added to the route index, the old behaviour is present as a fall back (for example when using new MarkdownPage in a test)

@caendesilva
Copy link
Member Author

This causes an issue with multiple source files with the same identifier, this is not an issue in actual code as you can't have multiple files with the same name anyways, but in tests where we do everything in-memory it can be an issue as seen here:

foreach ($pages as $page) {
$page = new $page('foo');
$this->assertInstanceOf(Route::class, $page->getRoute());
$this->assertEquals(new Route($page), $page->getRoute());

@caendesilva caendesilva marked this pull request as ready for review December 8, 2022 12:22
@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #739 (a9cfc85) into master (698593d) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##              master      #739   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity      1129      1129           
===========================================
  Files            137       137           
  Lines           2765      2765           
===========================================
  Hits            2765      2765           
Impacted Files Coverage Δ
packages/framework/src/Pages/Concerns/HydePage.php 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@caendesilva caendesilva merged commit 8ceccc3 into master Dec 8, 2022
@caendesilva caendesilva deleted the get-page-routes-from-the-route-index branch December 8, 2022 12:25
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.

Update HydePage::getRoute to get the route from the route index instead of creating new objects all the time
1 participant