Saleor 1662 sort just added channel availability (#878)

* Sort channels on ProductUpdate

* Update sorting channels after refactor

* Sort channels on every view
This commit is contained in:
Marek Choiński 2020-12-01 12:26:10 +01:00 committed by GitHub
parent 07f8f4b0b8
commit b16206dfa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,10 @@ function useChannels<T extends Channel>(channels: T[]) {
const handleChannelsModalOpen = () => setChannelsModalOpen(true); const handleChannelsModalOpen = () => setChannelsModalOpen(true);
const handleChannelsConfirm = () => { const handleChannelsConfirm = () => {
setCurrentChannels(channelListElements); const sortedChannelListElements = channelListElements.sort(
(channel, nextChannel) => channel.name.localeCompare(nextChannel.name)
);
setCurrentChannels(sortedChannelListElements);
setChannelsModalOpen(false); setChannelsModalOpen(false);
}; };