-
Notifications
You must be signed in to change notification settings - Fork 28
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
[Ember] 1on1 request: components & actions & structuring code in app #305
Comments
@rhjones I'll meet with you in the morning. If I understand your use-case correctly, some duplication may be necessary. Maybe we can come up with some heuristics to record here after looking at your code. |
After discussing some options, we decided to go with injecting the store into the component to do the CRUD on the favorites join. Arguments for doing it this way:
|
rhjones
added a commit
to rhjones/quiltr
that referenced
this issue
Nov 8, 2016
Inject store into favorite button component Instead of sending action, toggle favorite (add/delete favorite record) directly from component Why this approach? After talking with @Jrhorn, we decided this makes the most sense because: - component is used in multiple other components & routes - CRUD action involves adding/deleting a row from a join table - See ga-wdi-boston/capstone-project#305 (comment) for full details
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have two components that I'm reusing throughout my app, in other components and in different routes. For example: a "favorite this!" button that's visible at
/patterns
, at/patterns/:pattern_id
(thepattern
route), when viewing an individual project based on that pattern (at/projects/:project_id
), when viewing the user's list of favorites (favorites
), and in other places.I'm starting to repeat code for these components' actions across different routes (
pattern
,patterns
,favorites
, etc.), which seems less than ideal / prone to errors.I'd like to meet with someone for a few minutes to a) double check my understanding of how actions work / are connected across components and routes; and b) see if there's a way to reduce some of the repetition I'm experiencing.
The text was updated successfully, but these errors were encountered: