Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix target subscribers loading in templates #4358

Conversation

thecalcc
Copy link
Contributor

@thecalcc thecalcc commented Nov 2, 2023

SDESK-7074

@petrjasek petrjasek added this to the 2.7 milestone Nov 2, 2023
@@ -4,6 +4,7 @@ import {gettext} from 'core/utils';
import {ToggleBox, FormLabel, TreeSelect} from 'superdesk-ui-framework/react';
import {ControlledVocabulariesSelect} from './controlled-vocabulary-select';
import {IArticle} from 'superdesk-api';
import {render} from 'react-dom';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably don't need this?

@@ -1189,6 +1190,8 @@ export function MetadataService(api, subscribersService, vocabularies, $rootScop
_.each(items, (item) => {
self.values.customSubscribers.push({_id: item._id, name: item.name});
});

window.dispatchEvent(new CustomEvent('metadata-loaded'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of dispatching an event here, call fetchSubscribers on componentDidMount. Also improve fetchSubscribers so it's cached - something like fetchCities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's not cities, it's subscribers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's not cities. I was suggesting to look at how caching is implemented in fetchCities

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok just re-read it yeah.

@thecalcc thecalcc requested a review from tomaskikutis November 7, 2023 13:16

</ToggleBox>
return this.state.loading === false && (
<React.Fragment key={this.state.subscribers.length}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a key here since it's not being rendered in a list

@thecalcc thecalcc merged commit 3728be0 into superdesk:authoring-react-post-broadcasting Nov 8, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants