Skip to content

feat: correct implementation of partial block#699

Merged
sunng87 merged 2 commits into
masterfrom
fix/partial-context-merge
Mar 15, 2025
Merged

feat: correct implementation of partial block#699
sunng87 merged 2 commits into
masterfrom
fix/partial-context-merge

Conversation

@sunng87

@sunng87 sunng87 commented Mar 15, 2025

Copy link
Copy Markdown
Owner

Fixes #698 #696

This patch finally reimplements partial's block context correctly. The key is to remove all previous blocks and use a separated one for partial.

It corrects behavior of partial parameter, hash and merge_json:

  • if parameters is provided, either as path or literal, use it as base value; otherwise use this as base_value
  • if hash is provided, always merge it with base value:
    • if base value is associative type: object, array, string, merge them as map
    • if base value is non-associative type, return hash
      otherwise, use base value directly

When partial is rendered, reset blocks.

Tests added.

@coveralls

coveralls commented Mar 15, 2025

Copy link
Copy Markdown

Coverage Status

coverage: 82.233% (+0.3%) from 81.928%
when pulling cf2a8d0 on fix/partial-context-merge
into e9c4fe7 on master.

@sunng87 sunng87 merged commit 7fb336a into master Mar 15, 2025
@sunng87 sunng87 deleted the fix/partial-context-merge branch March 15, 2025 07:30
@hrydgard

Copy link
Copy Markdown

Thank you!

@sunng87

sunng87 commented Mar 15, 2025

Copy link
Copy Markdown
Owner Author

Just trying to validate on your project.

@sunng87

sunng87 commented Mar 15, 2025

Copy link
Copy Markdown
Owner Author

@hrydgard it should work now. I will look into another partial issue tomorrow and cut a release soon.

@hrydgard

hrydgard commented Apr 8, 2025

Copy link
Copy Markdown

Finally got around to updating. It works fine, thank you!

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.

6.3.1 generates incorrect output

3 participants