@selfcommunity/react-templates 0.3.50-events.83 → 0.3.50-events.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,17 +108,20 @@ function MainFeed(inProps) {
108
108
  feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
109
109
  };
110
110
  const handleAddGenerationContent = (feedObjects) => {
111
- feedObjects.forEach((feedObject) => {
112
- if (!feedRef && feedRef.current && feedRef.current.getCurrentFeedObjectIds().includes(feedObject.id)) {
113
- const feedUnit = {
114
- type: feedObject.type,
115
- [feedObject.type]: feedObject,
116
- seen_by_id: [],
117
- has_boost: false
118
- };
119
- feedRef.current.addFeedData(feedUnit, true);
120
- }
121
- });
111
+ if (feedRef && feedRef.current) {
112
+ const currentFeedObjectIds = feedRef.current.getCurrentFeedObjectIds();
113
+ feedObjects.forEach((feedObject) => {
114
+ if (!currentFeedObjectIds.includes(feedObject.id)) {
115
+ const feedUnit = {
116
+ type: feedObject.type,
117
+ [feedObject.type]: feedObject,
118
+ seen_by_id: [],
119
+ has_boost: false
120
+ };
121
+ feedRef.current.addFeedData(feedUnit, true);
122
+ }
123
+ });
124
+ }
122
125
  };
123
126
  return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: feedRef, endpoint: api_services_1.Endpoints.MainFeed, widgets: widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
124
127
  feedObject: item[item.type],
@@ -105,17 +105,20 @@ export default function MainFeed(inProps) {
105
105
  feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
106
106
  };
107
107
  const handleAddGenerationContent = (feedObjects) => {
108
- feedObjects.forEach((feedObject) => {
109
- if (!feedRef && feedRef.current && feedRef.current.getCurrentFeedObjectIds().includes(feedObject.id)) {
110
- const feedUnit = {
111
- type: feedObject.type,
112
- [feedObject.type]: feedObject,
113
- seen_by_id: [],
114
- has_boost: false
115
- };
116
- feedRef.current.addFeedData(feedUnit, true);
117
- }
118
- });
108
+ if (feedRef && feedRef.current) {
109
+ const currentFeedObjectIds = feedRef.current.getCurrentFeedObjectIds();
110
+ feedObjects.forEach((feedObject) => {
111
+ if (!currentFeedObjectIds.includes(feedObject.id)) {
112
+ const feedUnit = {
113
+ type: feedObject.type,
114
+ [feedObject.type]: feedObject,
115
+ seen_by_id: [],
116
+ has_boost: false
117
+ };
118
+ feedRef.current.addFeedData(feedUnit, true);
119
+ }
120
+ });
121
+ }
119
122
  };
120
123
  return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: feedRef, endpoint: Endpoints.MainFeed, widgets: widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
121
124
  feedObject: item[item.type],