Skip to content

Reuse RenderContext after executing partial #624

@gemhtcr

Description

@gemhtcr

For now, because of the following line of code, handlebars doens't share RenderContext when rendering partial.

https://github.com/sunng87/handlebars-rust/blob/9d7d5556287e31e4148841a56e0981b64a679fb6/src/partial.rs#L61C9-L61C39

  // Rust
 let partial = find_partial(rc, r, d, tname)?; 
  
 if let Some(t) = partial { 
     // clone to avoid lifetime issue 
     // FIXME refactor this to avoid 
     let mut local_rc = rc.clone();    // <---  This line can't reuse `RenderContext` after partial
  
     // if tname == PARTIAL_BLOCK 
     let is_partial_block = tname == PARTIAL_BLOCK; 
  
     // add partial block depth there are consecutive partial 

Is it possible to fix it and have a universal RenderContext when rendering ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions