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

Determine behaviour of createAll if $scope is null #5418

Open
patrickpatrickpatrick opened this issue Oct 16, 2024 · 0 comments
Open

Determine behaviour of createAll if $scope is null #5418

patrickpatrickpatrick opened this issue Oct 16, 2024 · 0 comments
Labels
awaiting triage Needs triaging by team

Comments

@patrickpatrickpatrick
Copy link
Contributor

patrickpatrickpatrick commented Oct 16, 2024

What

We need to determine if the current behaviour of createAll is correct as it stands (and update the documentation) or if we need to change it to take into account the case in which $scope is null.

Why

Currently if $scope passed into createAll is null because typeof null === 'object' it will throw a TypeError.

The current behaviour of createAll is that if $scope is falsy (not defined) then we set the scope of createAll to the document.

This raises the question; should the behaviour of createAll when $scope is falsy be the same as the behaviour of createAll when $scope is null?

There is a potential scenario when a user might want createAll to only execute on a specific $scope if it is not null and then not have it be executed on document if $scope is null. It is not clear from the documentation what they should do in this specific scenario.

If our intended behaviour is that $scope would default to document if $scope is null and the user wouldn't want this to occur, we should probably add:

To prevent component being created if `$element` is undefined:

if ($element) {
  createAll(ProjectComponent, undefined, $element)
}

to our documentation on creating components.

Otherwise if we want createAll to not execute if $scope is undefined then we'd need to change createAll to detect when $scope is null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting triage Needs triaging by team
Projects
Status: No status
Development

No branches or pull requests

1 participant