Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Transition SelectTagHelper and OptionTagHelper to use context.Items. #3392

Merged
merged 1 commit into from
Oct 23, 2015

Conversation

NTaylorMullen
Copy link
Contributor

@NTaylorMullen
Copy link
Contributor Author

/cc @dougbu

@@ -54,7 +54,7 @@ public override int Order

/// <inheritdoc />
/// <remarks>
/// Does nothing unless <see cref="FormContext.FormData"/> contains a
/// Does nothing unless <see cref="TagHelperContext.Items"/> contains a
/// <see cref="SelectTagHelper.SelectedValuesFormDataKey"/> entry and that entry is a non-empty
Copy link
Member

Choose a reason for hiding this comment

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

Throw SelectTagHelper.SelectedValuesFormDataKey away -- far away. This is an inefficient pattern that Items was designed to avoid. Instead use typeof(SelectTagHelper).

@dougbu
Copy link
Member

dougbu commented Oct 22, 2015

@NTaylorMullen
Copy link
Contributor Author

Updated.

@@ -131,7 +121,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)

// Whether or not (not being highly unlikely) we generate anything, could update contained <option/>
// elements. Provide selected values for <option/> tag helpers. They'll run next.
ViewContext.FormContext.FormData[SelectedValuesFormDataKey] = currentValues;
context.Items[typeof(SelectTagHelper)] = currentValues;
Copy link
Member

Choose a reason for hiding this comment

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

This will need to move to new Init() method as part of your reaction PR. Could you rebase that branch on top of this one? Or is that almost ready to get in first?

Copy link
Member

Choose a reason for hiding this comment

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

Now Init()s in, this should be there.

@dougbu
Copy link
Member

dougbu commented Oct 22, 2015

@NTaylorMullen NTaylorMullen force-pushed the nimullen/selecttaghelper.3347 branch from f99e45f to 96421a5 Compare October 22, 2015 23:07
@NTaylorMullen
Copy link
Contributor Author

Updated.

/// Thrown if <see cref="Items"/> is non-<c>null</c> but <see cref="For"/> is <c>null</c>.
/// </exception>
public override void Process(TagHelperContext context, TagHelperOutput output)
public override void Init(TagHelperContext context)
Copy link
Member

Choose a reason for hiding this comment

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

  • /// <inheritdoc />

@dougbu
Copy link
Member

dougbu commented Oct 22, 2015

:shipit: but may want to wait for Coherence to catch up since we can't confirm MVC builds at the moment.

@NTaylorMullen NTaylorMullen force-pushed the nimullen/selecttaghelper.3347 branch from 96421a5 to 24b16f0 Compare October 22, 2015 23:53
…ems`.

- Added functional tests to validate data created from a `SelectTagHelper` does not impact following `<select>` tags.
- Also moved the new `SelectTagHelper` communication flow into `TagHelper.Init`.

#3347
@NTaylorMullen NTaylorMullen force-pushed the nimullen/selecttaghelper.3347 branch from 24b16f0 to 911dfc5 Compare October 23, 2015 00:22
@NTaylorMullen NTaylorMullen merged commit 911dfc5 into dev Oct 23, 2015
@NTaylorMullen NTaylorMullen deleted the nimullen/selecttaghelper.3347 branch October 23, 2015 00:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants