Render several fragments of a view at once (fragments, fragmentsIf)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by reading the View::fragment and Template::block() APIs and how the engine consumes them; the issue names no source files or tests. Trace how fragment selection reaches an engine, then determine how ordered multiple fragments should be passed through and rendered. Done means fragments and fragments_if support multiple names while preserving single-fragment behavior and rendering in order.
Written by the indexing model from the issue text.
Description
Laravel's fragments(['a', 'b']) and fragmentsIf(...) render several fragments of one view in order, which htmx-style responses use to update more than one region at once. Laravel for Rust 0.2 has View::fragment and fragment_if for one fragment only.
use laravel::view::view;
let page = view("two", ()).fragment("a").fragment("b");
// The second call replaces the first: only "b" renders.
let page = view("two", ()).fragments(["a", "b"]);
// error[E0599]: no method named `fragments` found for struct `View`
View::fragment stores self.block = Some(..), and an Engine reads it through Template::block() -> Option<&str>, so a third-party engine can't receive more than one name either.
A possible shape: View::fragments(names) and fragments_if(condition, names), and Template::blocks() -> &[String] (keeping block() for a single fragment), with engines concatenating the fragments in the order given, as Laravel does.
Context: this came up while porting Blade to Laravel for Rust as a view engine (oxblade); it supports multiple fragments in its own API but can't receive them from View.
- Dominant language
- Rust
- Stars
- 847
- Forks
- 174
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 167
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from laravel/rust-framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
laravel/rust-framework#864 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
laravel/rust-framework#876 ·
Maintainers usually reply within 1 day
-
Case-sensitive contains, starts_with and ends_with that match % and _ literally on every databaseOpen
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#874 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
laravel/rust-framework#873 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#872 ·
Maintainers usually reply within 1 day
All issues in laravel/rust-framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neuralmagic/crucible#579 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-score/kyron#249 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
seanmonstar/reqwest#3157 ·
Maintainers usually reply within 2 days