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

Allow assign helper to be called multiple times #65

Open
iliekturtles opened this issue Aug 3, 2023 · 0 comments
Open

Allow assign helper to be called multiple times #65

iliekturtles opened this issue Aug 3, 2023 · 0 comments
Assignees

Comments

@iliekturtles
Copy link
Contributor

The assign helper clones the ctx parameter, assigns the value, and sets the result to the render context. Calling assign multiple times leaves the render context only containing the last assignment call.

let mut ctx = ctx.clone();
match ctx.data_mut() {
serde_json::value::Value::Object(m) => m.insert(name.to_owned(), value),
_ => None,
};
rc.set_context(ctx);

  • Should the original context be changed before assigning to the render context? This would allow for multiple assignments.
  • Is this actually desired behavior and the fix should be updated documentation? e.g. if calling assign multiple times is desired, a new complex object that maintains past values should be created.

Issue opened based on feedback in SuperCuber/dotter#134.

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

No branches or pull requests

2 participants