Closed nadeemja closed 7 years ago
Hello,
I would really appreciate some help on this.
The Problem A change in document causes components displaying other documents to re-render as well.
Expected behavior Only the component displaying the affected document should re-render.
Steps to recreate
The Setup
Publication server/publications/schedules.js
server/publications/schedules.js
... Meteor.publish('schedules.list', function schedulesList() { ... return Schedules.find(); }); ...
Container client/modules/schedules/containers/list.js
client/modules/schedules/containers/list.js
import { useDeps, composeAll, composeWithTracker, compose } from 'mantra-core'; import List from '../components/list.jsx'; export const composer = ({ context }, onData) => { const { Meteor, Collections } = context(); if (Meteor.subscribe('schedules.list').ready()) { const schedules = Collections.Schedules.find().fetch(); onData(null, { schedules }); } }; export const depsMapper = (context, actions) => ({ context: () => context, }); export default composeAll( composeWithTracker(composer), useDeps(depsMapper) )(List);
List Component client/modules/schedules/components/list.jsx
client/modules/schedules/components/list.jsx
import React from 'react'; import Item from './item.jsx'; const List = ({ schedules = [] } = {}) => ( <div> {schedules.map((schedule) => ( <Item schedule={schedule} key={schedule._id} /> ))} </div> ); export default List;
Item Component client/modules/schedules/components/item.jsx
client/modules/schedules/components/item.jsx
import React from 'react'; import { ... } from 'react-bootstrap'; const Item = ({ schedule = {} }) => ( <div> ... </div> ); export default Item;
i've the same issue
Yep. This will be fixed in 2.x - https://github.com/kadirahq/react-komposer/issues/123
Awesome, @arunoda! :)
Launched v2. Check the Performance section.
Hello,
I would really appreciate some help on this.
The Problem A change in document causes components displaying other documents to re-render as well.
Expected behavior Only the component displaying the affected document should re-render.
Steps to recreate
The Setup
Publication
server/publications/schedules.js
Container
client/modules/schedules/containers/list.js
List Component
client/modules/schedules/components/list.jsx
Item Component
client/modules/schedules/components/item.jsx