Best practice for syncing multiple redux stores











up vote
1
down vote

favorite
1












We have an application that been managed across multiple teams, we would like to create the flexibility and isolation between the apps by using micro frontend approach, each application will have its own store.



some of the apps are using the same data, we would like to reduce the number of duplicate data been fetch from the server.



I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores.



What and how should be the best way to sync data between the stores?



Few points:




  • All data have been fetch from our backend services

  • The data structure is the same, but not all apps using the same data, some using subset of the datam

  • Inorder to reduce the duplication of API calls we would like that "small stores" will be able to sync the data from the "main" store










share|improve this question




















  • 1




    The question isn't specific enough. It's unknown whether data structures are the same. It's unknown how data is handled. If I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores. - a good thing about apps is that they can be refactored to solve design problems.
    – estus
    Nov 18 at 11:11










  • @estus thank you for the comment, regarding the refactoring point - will add the relevant info. currently, we are not able to do so. its to expensive
    – USer22999299
    Nov 18 at 12:05










  • Possibly a middleware that will listen for changes in one store and dispatch updates to another one. This will be hacky and possibly expensive too. But again, this totally depends on specific case. If it's initial data that needs to be synced, that's one thing. If data changes with time, that's another thing. The question will likely be closed any way. I suppose that you've been on SO long enough to see that such broad questions cannot get constructive answers.
    – estus
    Nov 18 at 12:08










  • The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.
    – estus
    Nov 18 at 12:12












  • @estus that's true if i'm waving back to my question - that's the case, i need to sync between multiple stores - looking for the best solution. currently the refactoring of the app will take to much time to have a single store. if we had the time - we would do it.
    – USer22999299
    Nov 18 at 15:08















up vote
1
down vote

favorite
1












We have an application that been managed across multiple teams, we would like to create the flexibility and isolation between the apps by using micro frontend approach, each application will have its own store.



some of the apps are using the same data, we would like to reduce the number of duplicate data been fetch from the server.



I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores.



What and how should be the best way to sync data between the stores?



Few points:




  • All data have been fetch from our backend services

  • The data structure is the same, but not all apps using the same data, some using subset of the datam

  • Inorder to reduce the duplication of API calls we would like that "small stores" will be able to sync the data from the "main" store










share|improve this question




















  • 1




    The question isn't specific enough. It's unknown whether data structures are the same. It's unknown how data is handled. If I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores. - a good thing about apps is that they can be refactored to solve design problems.
    – estus
    Nov 18 at 11:11










  • @estus thank you for the comment, regarding the refactoring point - will add the relevant info. currently, we are not able to do so. its to expensive
    – USer22999299
    Nov 18 at 12:05










  • Possibly a middleware that will listen for changes in one store and dispatch updates to another one. This will be hacky and possibly expensive too. But again, this totally depends on specific case. If it's initial data that needs to be synced, that's one thing. If data changes with time, that's another thing. The question will likely be closed any way. I suppose that you've been on SO long enough to see that such broad questions cannot get constructive answers.
    – estus
    Nov 18 at 12:08










  • The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.
    – estus
    Nov 18 at 12:12












  • @estus that's true if i'm waving back to my question - that's the case, i need to sync between multiple stores - looking for the best solution. currently the refactoring of the app will take to much time to have a single store. if we had the time - we would do it.
    – USer22999299
    Nov 18 at 15:08













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





We have an application that been managed across multiple teams, we would like to create the flexibility and isolation between the apps by using micro frontend approach, each application will have its own store.



some of the apps are using the same data, we would like to reduce the number of duplicate data been fetch from the server.



I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores.



What and how should be the best way to sync data between the stores?



Few points:




  • All data have been fetch from our backend services

  • The data structure is the same, but not all apps using the same data, some using subset of the datam

  • Inorder to reduce the duplication of API calls we would like that "small stores" will be able to sync the data from the "main" store










share|improve this question















We have an application that been managed across multiple teams, we would like to create the flexibility and isolation between the apps by using micro frontend approach, each application will have its own store.



some of the apps are using the same data, we would like to reduce the number of duplicate data been fetch from the server.



I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores.



What and how should be the best way to sync data between the stores?



Few points:




  • All data have been fetch from our backend services

  • The data structure is the same, but not all apps using the same data, some using subset of the datam

  • Inorder to reduce the duplication of API calls we would like that "small stores" will be able to sync the data from the "main" store







reactjs redux redux-store micro-frontend






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 12:04

























asked Nov 18 at 10:09









USer22999299

1,48722252




1,48722252








  • 1




    The question isn't specific enough. It's unknown whether data structures are the same. It's unknown how data is handled. If I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores. - a good thing about apps is that they can be refactored to solve design problems.
    – estus
    Nov 18 at 11:11










  • @estus thank you for the comment, regarding the refactoring point - will add the relevant info. currently, we are not able to do so. its to expensive
    – USer22999299
    Nov 18 at 12:05










  • Possibly a middleware that will listen for changes in one store and dispatch updates to another one. This will be hacky and possibly expensive too. But again, this totally depends on specific case. If it's initial data that needs to be synced, that's one thing. If data changes with time, that's another thing. The question will likely be closed any way. I suppose that you've been on SO long enough to see that such broad questions cannot get constructive answers.
    – estus
    Nov 18 at 12:08










  • The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.
    – estus
    Nov 18 at 12:12












  • @estus that's true if i'm waving back to my question - that's the case, i need to sync between multiple stores - looking for the best solution. currently the refactoring of the app will take to much time to have a single store. if we had the time - we would do it.
    – USer22999299
    Nov 18 at 15:08














  • 1




    The question isn't specific enough. It's unknown whether data structures are the same. It's unknown how data is handled. If I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores. - a good thing about apps is that they can be refactored to solve design problems.
    – estus
    Nov 18 at 11:11










  • @estus thank you for the comment, regarding the refactoring point - will add the relevant info. currently, we are not able to do so. its to expensive
    – USer22999299
    Nov 18 at 12:05










  • Possibly a middleware that will listen for changes in one store and dispatch updates to another one. This will be hacky and possibly expensive too. But again, this totally depends on specific case. If it's initial data that needs to be synced, that's one thing. If data changes with time, that's another thing. The question will likely be closed any way. I suppose that you've been on SO long enough to see that such broad questions cannot get constructive answers.
    – estus
    Nov 18 at 12:08










  • The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.
    – estus
    Nov 18 at 12:12












  • @estus that's true if i'm waving back to my question - that's the case, i need to sync between multiple stores - looking for the best solution. currently the refactoring of the app will take to much time to have a single store. if we had the time - we would do it.
    – USer22999299
    Nov 18 at 15:08








1




1




The question isn't specific enough. It's unknown whether data structures are the same. It's unknown how data is handled. If I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores. - a good thing about apps is that they can be refactored to solve design problems.
– estus
Nov 18 at 11:11




The question isn't specific enough. It's unknown whether data structures are the same. It's unknown how data is handled. If I know that it sounds like we should use a single store in that case, but the chose all ready to use multiple stores. - a good thing about apps is that they can be refactored to solve design problems.
– estus
Nov 18 at 11:11












@estus thank you for the comment, regarding the refactoring point - will add the relevant info. currently, we are not able to do so. its to expensive
– USer22999299
Nov 18 at 12:05




@estus thank you for the comment, regarding the refactoring point - will add the relevant info. currently, we are not able to do so. its to expensive
– USer22999299
Nov 18 at 12:05












Possibly a middleware that will listen for changes in one store and dispatch updates to another one. This will be hacky and possibly expensive too. But again, this totally depends on specific case. If it's initial data that needs to be synced, that's one thing. If data changes with time, that's another thing. The question will likely be closed any way. I suppose that you've been on SO long enough to see that such broad questions cannot get constructive answers.
– estus
Nov 18 at 12:08




Possibly a middleware that will listen for changes in one store and dispatch updates to another one. This will be hacky and possibly expensive too. But again, this totally depends on specific case. If it's initial data that needs to be synced, that's one thing. If data changes with time, that's another thing. The question will likely be closed any way. I suppose that you've been on SO long enough to see that such broad questions cannot get constructive answers.
– estus
Nov 18 at 12:08












The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.
– estus
Nov 18 at 12:12






The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.
– estus
Nov 18 at 12:12














@estus that's true if i'm waving back to my question - that's the case, i need to sync between multiple stores - looking for the best solution. currently the refactoring of the app will take to much time to have a single store. if we had the time - we would do it.
– USer22999299
Nov 18 at 15:08




@estus that's true if i'm waving back to my question - that's the case, i need to sync between multiple stores - looking for the best solution. currently the refactoring of the app will take to much time to have a single store. if we had the time - we would do it.
– USer22999299
Nov 18 at 15:08












1 Answer
1






active

oldest

votes

















up vote
0
down vote













As @estus noticed




The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.




... but for me this is a perfect case for graphQL/Apollo.



You can move/delegate data fetching (or even entire local app state) to one 'engine' and it will work exactly the same for all application parts (the same API endpoint).



There are many good things with this approach:




  • separation data from app state(-s);

  • cache and query batching (not only removing duplications but 'gluing' many queries in one);

  • cache policies (only network, only cache);

  • API stitching (future extensions, wrapping external services) ...


There is a nice starter for Apollo (contains redux parts).



PS. Apollo can work with REST APIs






share|improve this answer























  • This is just an improvement to the single store or i missing something :) ?
    – USer22999299
    Nov 18 at 15:52










  • This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
    – xadm
    Nov 18 at 16:34











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359742%2fbest-practice-for-syncing-multiple-redux-stores%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













As @estus noticed




The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.




... but for me this is a perfect case for graphQL/Apollo.



You can move/delegate data fetching (or even entire local app state) to one 'engine' and it will work exactly the same for all application parts (the same API endpoint).



There are many good things with this approach:




  • separation data from app state(-s);

  • cache and query batching (not only removing duplications but 'gluing' many queries in one);

  • cache policies (only network, only cache);

  • API stitching (future extensions, wrapping external services) ...


There is a nice starter for Apollo (contains redux parts).



PS. Apollo can work with REST APIs






share|improve this answer























  • This is just an improvement to the single store or i missing something :) ?
    – USer22999299
    Nov 18 at 15:52










  • This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
    – xadm
    Nov 18 at 16:34















up vote
0
down vote













As @estus noticed




The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.




... but for me this is a perfect case for graphQL/Apollo.



You can move/delegate data fetching (or even entire local app state) to one 'engine' and it will work exactly the same for all application parts (the same API endpoint).



There are many good things with this approach:




  • separation data from app state(-s);

  • cache and query batching (not only removing duplications but 'gluing' many queries in one);

  • cache policies (only network, only cache);

  • API stitching (future extensions, wrapping external services) ...


There is a nice starter for Apollo (contains redux parts).



PS. Apollo can work with REST APIs






share|improve this answer























  • This is just an improvement to the single store or i missing something :) ?
    – USer22999299
    Nov 18 at 15:52










  • This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
    – xadm
    Nov 18 at 16:34













up vote
0
down vote










up vote
0
down vote









As @estus noticed




The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.




... but for me this is a perfect case for graphQL/Apollo.



You can move/delegate data fetching (or even entire local app state) to one 'engine' and it will work exactly the same for all application parts (the same API endpoint).



There are many good things with this approach:




  • separation data from app state(-s);

  • cache and query batching (not only removing duplications but 'gluing' many queries in one);

  • cache policies (only network, only cache);

  • API stitching (future extensions, wrapping external services) ...


There is a nice starter for Apollo (contains redux parts).



PS. Apollo can work with REST APIs






share|improve this answer














As @estus noticed




The data structure is the same, but not all apps using the same data, some using subset of the data - yes, this looks like a good use case for single store.




... but for me this is a perfect case for graphQL/Apollo.



You can move/delegate data fetching (or even entire local app state) to one 'engine' and it will work exactly the same for all application parts (the same API endpoint).



There are many good things with this approach:




  • separation data from app state(-s);

  • cache and query batching (not only removing duplications but 'gluing' many queries in one);

  • cache policies (only network, only cache);

  • API stitching (future extensions, wrapping external services) ...


There is a nice starter for Apollo (contains redux parts).



PS. Apollo can work with REST APIs







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 18 at 14:03

























answered Nov 18 at 13:39









xadm

1,560148




1,560148












  • This is just an improvement to the single store or i missing something :) ?
    – USer22999299
    Nov 18 at 15:52










  • This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
    – xadm
    Nov 18 at 16:34


















  • This is just an improvement to the single store or i missing something :) ?
    – USer22999299
    Nov 18 at 15:52










  • This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
    – xadm
    Nov 18 at 16:34
















This is just an improvement to the single store or i missing something :) ?
– USer22999299
Nov 18 at 15:52




This is just an improvement to the single store or i missing something :) ?
– USer22999299
Nov 18 at 15:52












This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
– xadm
Nov 18 at 16:34




This is 'just' an solution to shared data fetching w/o single store refactoring, syncing and future problems ;) IMHO it's far more than improvement. Using HOCs (not query/mutation components) you can enhance existing components (redux connected) in the same way as with redux.
– xadm
Nov 18 at 16:34


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359742%2fbest-practice-for-syncing-multiple-redux-stores%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]