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

Remove subscription to the application locale #65

Closed
jasonmit opened this issue Mar 3, 2015 · 5 comments
Closed

Remove subscription to the application locale #65

jasonmit opened this issue Mar 3, 2015 · 5 comments

Comments

@jasonmit
Copy link
Member

jasonmit commented Mar 3, 2015

I've been following @caridy's discussions on this topic in another thread where he makes the case that subscribing to locale changes to trigger a rerender of the component/helper is not a common pattern.

For example, if the users changes their locale at runtime, any helpers rendered after the change will receive the new locale change. Anything rendered previously will stay rendered on the previous locale. Handling this really complicates the helper logic and there is overhead in subscribing to those changes for each and every helper.

The workaround would be recommending users to reload the view explicitly using a rerender where they need to immediately reflect the change.

Unfortunately, we cannot begin removing this yet because the application view is not able to rerender. This is demonstrated here http://jsbin.com/ruzuho/1/edit?html,js,console,output (click rerender twice, observe the console while doing so). So, until that bug is fixed within Ember we cannot resolve this issue.

/cc @caridy

@caridy
Copy link

caridy commented Mar 4, 2015

When you mean workaround, you mean removing those listeners, and rely on some sort of best practice (doc) to explain that they should re-render manually?

Can you link to the corresponding ember issue?

@jasonmit
Copy link
Member Author

jasonmit commented Mar 4, 2015

When you mean workaround, you mean removing those listeners, and rely on some sort of best practice (doc) to explain that they should re-render manually?

Correct. Remove the listeners and provide documentation for the < 80% use case.

The issue: emberjs/ember.js#2267 looks like it was closed but has regressed if it was in fact fixed at some point. Though, I've seen this issue since as long as I can remember using Ember.

@caridy
Copy link

caridy commented Mar 4, 2015

🎾

@jasonmit jasonmit changed the title Remove subscribing to the application locale Remove subscription to the application locale Mar 4, 2015
@jasonmit
Copy link
Member Author

Spoke to Paul (@tchak13) and he currently does an app destroy and recreates to work around this issue. We can implement the same pattern and document it as a work around for the 1% case where consumers want to change the locale at runtime.

@jasonmit
Copy link
Member Author

Will keep this around now that the new Ember.Helper better supports the usecase.

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

2 participants