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

Fixes error binding context in layout #229

Closed
wants to merge 1 commit into from
Closed

Fixes error binding context in layout #229

wants to merge 1 commit into from

Conversation

Magentaize
Copy link
Contributor

No description provided.

@@ -87,6 +87,10 @@ private object GetContextVariable(string variableName, object target)
{
object returnValue;
variableName = variableName.TrimStart('@');
if (target.GetType() == typeof(HandlebarsCompiler.DynamicViewModel))
{
target = ((HandlebarsCompiler.DynamicViewModel) target).Objects[1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is concerning. I don’t understand how the 1nth position in the objects array is known to be the right value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At HandlebarsCompiler.cs line 64, it passes a DynamicViewModel instance with a argument object[] which the second object is the corresponding view model

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Positional significance is a code smell. If specific elements in the array have unique meaning, they should be made part of the model.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's a bad design and the whole #76 should be re-considered.

@rexm
Copy link
Member

rexm commented Apr 27, 2019

Going to avoid any additional investment in the baked-in view engine and focus on a better extensibility model in v2 that will afford well-designed view engines.

@rexm rexm closed this Apr 27, 2019
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.

None yet

2 participants