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

Reset view paths after request #7030

Merged
merged 5 commits into from
Nov 9, 2022
Merged

Reset view paths after request #7030

merged 5 commits into from
Nov 9, 2022

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Nov 9, 2022

Fixes statamic/ssg#116
Related statamic/ssg#119

This PR will reset the view paths and namespace hints after the request completes. This prevents them from leaking into other requests, for example in tests or in the SSG.

The tests are tweaked so that the assertion happens in the closure (simulating within the context of a request).

The middleware is also refactored so that the handle method is more readable.

@what-the-diff
Copy link

what-the-diff bot commented Nov 9, 2022

  • The AddViewPaths middleware was refactored to be more testable.
  • A new method, updateHints(), was added that updates the view hints for namespaced views based on the current site handle and locale code (if applicable).
  • Tests were updated accordingly to reflect these changes in functionality and structure of this class/middleware.

If there happens to be another assertion, the test could technically pass without the main assertion even running.
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.

Multisite SSG is taking an exponential amount of time to generate
1 participant