[5.x] Fix issues with Blade nav tag compiler #11872
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #11806.
Problem
The current implementation of the
nav
compiler will create a temporary file and include that behind the scenes, which worked in supporting recursive children. However, this causes issues when importing classes or functions, as this information would be lost inside the hidden temporary file.Additionally, because the current implementation triggers a Blade compilating in creating that temporary file, it can mess with the internal raw block state, causing placeholder strings like
@__raw_block_1__@
to appear in the output.The Fix
This PR addresses both issues by refactoring away the temporary file, and instead inlines the compiled navigation code in a function. Recursive navigation support is maintained by simply calling that compiled function instead of including a hidden view.