-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix target subscribers loading in templates #4358
Conversation
@@ -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'; |
There was a problem hiding this comment.
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')); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
||
</ToggleBox> | ||
return this.state.loading === false && ( | ||
<React.Fragment key={this.state.subscribers.length}> |
There was a problem hiding this comment.
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
3728be0
into
superdesk:authoring-react-post-broadcasting
SDESK-7074