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

Identity functions don't handle 'formatted' type #7311

Closed
ChrisLoer opened this issue Sep 20, 2018 · 0 comments
Closed

Identity functions don't handle 'formatted' type #7311

ChrisLoer opened this issue Sep 20, 2018 · 0 comments
Assignees
Labels

Comments

@ChrisLoer
Copy link
Contributor

Adding a text-field that uses an identity function (eg "text-field": { "property": "name", "type": "identity" }) doesn't work after the introduction of the format expression (#6994) because the identity function pathway skips the automatic string->Formatted coercion that the expressions/tokens pathway follows. I think we just need to add an explicit case for Formatted here:

function evaluateIdentityFunction(parameters, propertySpec, input) {
if (propertySpec.type === 'color') {
input = Color.parse(input);
} else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
input = undefined;
}
return coalesce(input, parameters.default, propertySpec.default);
}

/cc @ryanhamley @jplante

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant