Merge branch 'remote-instance-fix' into 'main'
actually fix: Cannot Pin/Unpin Instances See merge request soapbox-pub/soapbox!2972
This commit is contained in:
commit
031c6e11ea
3 changed files with 7 additions and 7 deletions
|
@ -1,11 +1,11 @@
|
||||||
import { getSettings, changeSetting } from 'soapbox/actions/settings';
|
import { getSettings, changeSetting } from 'soapbox/actions/settings';
|
||||||
|
|
||||||
import type { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import type { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import type { AppDispatch, RootState } from 'soapbox/store';
|
import type { AppDispatch, RootState } from 'soapbox/store';
|
||||||
|
|
||||||
const getPinnedHosts = (state: RootState) => {
|
const getPinnedHosts = (state: RootState) => {
|
||||||
const settings = getSettings(state);
|
const settings = getSettings(state);
|
||||||
return settings.getIn(['remote_timeline', 'pinnedHosts']) as ImmutableOrderedSet<string>;
|
return settings.getIn(['remote_timeline', 'pinnedHosts']) as ImmutableList<string> | ImmutableOrderedSet<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const pinHost = (host: string) =>
|
const pinHost = (host: string) =>
|
||||||
|
@ -13,7 +13,7 @@ const pinHost = (host: string) =>
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const pinnedHosts = getPinnedHosts(state);
|
const pinnedHosts = getPinnedHosts(state);
|
||||||
|
|
||||||
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.add(host)));
|
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.toOrderedSet().add(host)));
|
||||||
};
|
};
|
||||||
|
|
||||||
const unpinHost = (host: string) =>
|
const unpinHost = (host: string) =>
|
||||||
|
@ -21,7 +21,7 @@ const unpinHost = (host: string) =>
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const pinnedHosts = getPinnedHosts(state);
|
const pinnedHosts = getPinnedHosts(state);
|
||||||
|
|
||||||
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.remove(host)));
|
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.toOrderedSet().remove(host)));
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
import { defineMessage } from 'react-intl';
|
import { defineMessage } from 'react-intl';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
@ -169,7 +169,7 @@ const defaultSettings = ImmutableMap({
|
||||||
]),
|
]),
|
||||||
|
|
||||||
remote_timeline: ImmutableMap({
|
remote_timeline: ImmutableMap({
|
||||||
pinnedHosts: ImmutableOrderedSet(),
|
pinnedHosts: ImmutableList(),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ const PinnedHostsPicker: React.FC<IPinnedHostsPicker> = ({ host: activeHost }) =
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HStack className='mb-4' space={2}>
|
<HStack className='mb-4' space={2}>
|
||||||
{pinnedHosts.map((host: any) => (
|
{pinnedHosts.map((host) => (
|
||||||
<Button
|
<Button
|
||||||
key={host}
|
key={host}
|
||||||
to={`/timeline/${host}`}
|
to={`/timeline/${host}`}
|
||||||
|
|
Loading…
Reference in a new issue