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

restructure code to reduce dependencies #973

Open
dave-doty opened this issue Apr 3, 2024 · 0 comments
Open

restructure code to reduce dependencies #973

dave-doty opened this issue Apr 3, 2024 · 0 comments
Labels
challenging indicates that fixing this issue is expected to be more challenging than average enhancement New feature or request

Comments

@dave-doty
Copy link
Member

dave-doty commented Apr 3, 2024

See google/built_value.dart#1304

I'm not sure how feasible this is given the current architecture. As David Morgan said, we use this global variable app all over the place, so in some sense anywhere it's used essentially the whole project is being imported. But maybe it's possible to use packages to officially declare that the view depends on the model but not the other way around, for instance. Similarly the reducers depend on the model but not the other way around, and there's no dependence between the view and reducers.

Most of the usages of the global app variable are:

  1. Calling app.dispatch to dispatch an action. This is done through app because it stores the Redux stores.
  2. Accessing the AppState. This is typically done in code in view files, but not in React render methods, in keeping with the principle I explained here: https://stackoverflow.com/questions/62942644/how-to-make-a-react-component-intelligently-dispatch-a-redux-action-on-user-inte.

Unfortunately, these both in some sense seem to preclude splitting up the app variable into other smaller global variables. The first is needed to access the Redux stores, one of which stores the entire current AppState, and the second also requires accessing the current AppState, also through the main store.

@dave-doty dave-doty added enhancement New feature or request challenging indicates that fixing this issue is expected to be more challenging than average labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenging indicates that fixing this issue is expected to be more challenging than average enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant