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

Rename the layout decorator in case of conflict #55

Closed
ssutar opened this issue Jan 18, 2019 · 0 comments
Closed

Rename the layout decorator in case of conflict #55

ssutar opened this issue Jan 18, 2019 · 0 comments

Comments

@ssutar
Copy link
Contributor

ssutar commented Jan 18, 2019

We used to rename the imported variable in case layout decorator has naming conflict.

There were 2 issues with the previous approach:

  1. All occurrences of the variable need to be renamed in the current file, its hard to determine the local/global scoped var

  2. It was not able to handle the cases where the layout is passed down to the child components. Not sure if this is standard pattern but I've seen few examples of it.

Its better to rename the decorator itself so that we don't have to update the local vars which might introduce unexpected behavior

So instead of transforming to

import { layout } from "@ember-decorators/component";
import templateLayout from "components/templates/foo";

@layout(templateLayout)
class Foo extends EmberObject {}

it should be:

import { layout as templateLayout } from "@ember-decorators/component";
import layout from "components/templates/foo";

@templateLayout(layout)
class Foo extends EmberObject {}
pzuraq pushed a commit that referenced this issue Jan 22, 2019
@ssutar ssutar closed this as completed Jan 23, 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

No branches or pull requests

1 participant