Fragment state doesn't work when there is a module of the same name
See original GitHub issuehttps://gist.github.com/Pyrolistical/882622fe00822418783dc63edcf04bf6
Demo
actions: {
doubleUsingGlobal(state, actions) {
return {
counter: {
count: 2 * state.counter.count
}
}
},
// this doesn't work due to module vs fragment conflict
counter: {
doubleUsingFragment(state, actions) {
return {
count: 2 * state.count
}
}
}
},
modules: {
counter
}
doubleUsingGlobal breaks the module due to #437, but is unrelated to this issue
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Dagger 2 on Android: inject same dependency in Activity and ...
To work around this problem, I have to create the FragmentComponent and inject dependencies in MyFragment.onActivityCreated rather than MyFragment.onCreate . On ...
Read more >Fragment transactions - Android Developers
The fragment remains in the same state ( STOPPED ) as when it is put on the back stack. This means that the...
Read more >Understanding C++ Modules: Part 3: Linkage and Fragments
External linkage pertains to entities declared extern, functions, class types and their members (including static members), and variables, and ...
Read more >Creating and Using Fragments | CodePath Android Cliffnotes
A Fragment is a combination of an XML layout file and a java class much like an Activity . Using the support library,...
Read more >Docs • Svelte
If that's not you (yet), you may prefer to visit the interactive tutorial or the ... don't do this. it will run before...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems like a good candidate for “dev build” warnings. Conflicting namespaces just need to be avoided, in my opinion.
Does the current documentation make it clear that modules will occupy the namespace you assigned in the larger state/actions trees?
I see no issue with the current behavior, honestly.
Without a solution for this, there is only one way to monkey patch a module.
That will replace the entire
counter
slice with a new counter object, instead of updatingcount
’s value.Now, that will work just as if
doubleUsingFragment
was an action under the counter slice and update onlycount
.On the other hand, you still can’t monkey patch an action, as the module’s definition will take precedence, so maybe there is too little gain adding a solution for this.
I am going to close here with wontfix. But I am willing to revisit this in the future if the issue comes up again.