Comments (6)
Notice that FlowRouter.subscriptions() is deprecated (or will get deprecated). (see https://github.com/kadirahq/flow-router#subscription-management).
I would recommend do take a close look at the mantra-sample-application and see how containers work.
In your example, you can put your subscription: Meteor.subscribe('globalPubs');
just where you have put the comment Subscription code here..
See also here for a sample: https://github.com/mantrajs/mantra-sample-blog-app/blob/master/client/modules/core/containers/post.js
from mantra.
Create a container for the Layout and subscribe there.
from mantra.
Another solution I have used with Mantra is to use the subs-manager plugin and create an instance of SubsManager globally in client/configs/context.js
from mantra.
Create a container for the Layout and subscribe there.
@merlinpatt Yes, I did. but it did not work.
I found a way, not sure if it's the 'proper' way to do this, I used FlowRouter.subscriptions() since it's already built in with the package.
Thanks for the help!
from mantra.
@macrozone Thanks for the heads up! I'll find other ways to do this.
from mantra.
here is how is soled 'global' subs:
layout.jsx
const Layout = ({content = () => null}) => {
return (
<LoadInitDataContainer>
{content()}
</LoadInitDataContainer>
)
};
LoadInitDataContainer
export const composer = ({context}, onData) => {
const {Meteor} = context();
if(Meteor.subscribe('foo').ready()) {
onData(null, {})
}
};
// ------ C O M P O N E N T ----------------------------------------------------
const LoadInitData = ({children}) => {
return children;
};
export default LoadInitData;
export const LoadInitDataContainer = composeAll(
compose(composer),
useDeps()
)(LoadInitData);
from mantra.
Related Issues (20)
- Correct Way to Install a Bootstrap Theme? HOT 3
- Controllers and server-side context HOT 3
- Where is the best place to put your initial states with Reactive Dict/Local State HOT 1
- Unable to sign up /login on Mantra talk HOT 4
- should we use sub-manager for mantra ? HOT 2
- A linter for Mantra
- Accounts.onPasswordResetLink .... where??
- Dead link for Mantra live demo HOT 2
- Support Apollo HOT 1
- Meteor/MiniMongo is Local State HOT 1
- Issue with re-rendering on Google Chrome Android (Moblie)
- Meteor methods in lib folder HOT 1
- Problem with Routing and Alert
- More intuitive react component naming convention HOT 4
- Ability to module-namespace actions HOT 13
- Issue with Mobile HOT 1
- how to get REF of containers component
- Clarify module meaning HOT 5
- Problems with @storybook/mantra-core and react-komposer@2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mantra.