Skip to content

Return null/undefined from find() when the component isn't found #34

@pward123

Description

@pward123

Is there a reason that FlowComponents.find() throws an exception when a component is not found?

I have an existing project with modal dialog support that retrieves the template name to display from a session variable. I would like to add direct component support by doing something like:

{{#if isComponentModal}}
  {{> render component=template}}
{{else}}
  {{> template}}
{{/if}}
ModalDialog.helpers.isComponentModal = function() {
  return FlowComponents.find(App.activeModalName());
}

ModalDialog.helpers.template = function() {
  return App.activeModalName();
}

However, the find call is throw an error when the component is not found. Obviously, I can just wrap the find call with a try/catch block, but it seems strange to have find() throw an error in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions