refactor: Rewrite immutablejs import statements using destructuring (#4147)
This commit is contained in:
committed by
Eugen Rochko
parent
7bacdd718a
commit
cc68d1945b
@ -1,5 +1,5 @@
|
||||
import api, { getLinks } from '../api';
|
||||
import Immutable from 'immutable';
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
import IntlMessageFormat from 'intl-messageformat';
|
||||
import { fetchRelationships } from './accounts';
|
||||
import { defineMessages } from 'react-intl';
|
||||
@ -124,7 +124,7 @@ export function refreshNotificationsFail(error, skipLoading) {
|
||||
|
||||
export function expandNotifications() {
|
||||
return (dispatch, getState) => {
|
||||
const items = getState().getIn(['notifications', 'items'], Immutable.List());
|
||||
const items = getState().getIn(['notifications', 'items'], ImmutableList());
|
||||
|
||||
if (getState().getIn(['notifications', 'isLoading']) || items.size === 0) {
|
||||
return;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import Immutable from 'immutable';
|
||||
import { Iterable, fromJS } from 'immutable';
|
||||
|
||||
export const STORE_HYDRATE = 'STORE_HYDRATE';
|
||||
export const STORE_HYDRATE_LAZY = 'STORE_HYDRATE_LAZY';
|
||||
|
||||
const convertState = rawState =>
|
||||
Immutable.fromJS(rawState, (k, v) =>
|
||||
Immutable.Iterable.isIndexed(v) ? v.toList() : v.toMap().mapKeys(x =>
|
||||
fromJS(rawState, (k, v) =>
|
||||
Iterable.isIndexed(v) ? v.toList() : v.toMap().mapKeys(x =>
|
||||
Number.isNaN(x * 1) ? x : x * 1));
|
||||
|
||||
export function hydrateStore(rawState) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import api, { getLinks } from '../api';
|
||||
import Immutable from 'immutable';
|
||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||
|
||||
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
|
||||
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
|
||||
@ -66,13 +66,13 @@ export function refreshTimelineRequest(timeline, skipLoading) {
|
||||
|
||||
export function refreshTimeline(timelineId, path, params = {}) {
|
||||
return function (dispatch, getState) {
|
||||
const timeline = getState().getIn(['timelines', timelineId], Immutable.Map());
|
||||
const timeline = getState().getIn(['timelines', timelineId], ImmutableMap());
|
||||
|
||||
if (timeline.get('isLoading') || timeline.get('online')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ids = timeline.get('items', Immutable.List());
|
||||
const ids = timeline.get('items', ImmutableList());
|
||||
const newestId = ids.size > 0 ? ids.first() : null;
|
||||
|
||||
let skipLoading = timeline.get('loaded');
|
||||
@ -111,8 +111,8 @@ export function refreshTimelineFail(timeline, error, skipLoading) {
|
||||
|
||||
export function expandTimeline(timelineId, path, params = {}) {
|
||||
return (dispatch, getState) => {
|
||||
const timeline = getState().getIn(['timelines', timelineId], Immutable.Map());
|
||||
const ids = timeline.get('items', Immutable.List());
|
||||
const timeline = getState().getIn(['timelines', timelineId], ImmutableMap());
|
||||
const ids = timeline.get('items', ImmutableList());
|
||||
|
||||
if (timeline.get('isLoading') || ids.size === 0) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user