Reversed order of incoming nav events
Summary: Since events will be displayed in a timeline view with a flex-cloumn, it is more efficient to have the events be added to the event array in reverse order; that is the newest events at the front of the array. Reviewed By: passy Differential Revision: D16379893 fbshipit-source-id: c85a2cca118e2d4ae990f69134f5d5770c360fbd
This commit is contained in:
committed by
Facebook Github Bot
parent
9b82dc5025
commit
aeee96c050
@@ -74,11 +74,11 @@ test('add incoming nav event to persisted state with nav events', () => {
|
|||||||
INCOMING_NAV_EVENT,
|
INCOMING_NAV_EVENT,
|
||||||
);
|
);
|
||||||
expect(newPersistedState.navigationEvents).toEqual([
|
expect(newPersistedState.navigationEvents).toEqual([
|
||||||
...persistedState.navigationEvents,
|
|
||||||
{
|
{
|
||||||
uri: 'mock://this_is_a_mock_uri/mock',
|
uri: 'mock://this_is_a_mock_uri/mock',
|
||||||
date: DATE_MOCK_1,
|
date: DATE_MOCK_1,
|
||||||
},
|
},
|
||||||
|
...persistedState.navigationEvents,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
expect(reducer).not.toBeNull();
|
expect(reducer).not.toBeNull();
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ export default class extends FlipperPlugin<State, {}, PersistedState> {
|
|||||||
return {
|
return {
|
||||||
...persistedState,
|
...persistedState,
|
||||||
navigationEvents: [
|
navigationEvents: [
|
||||||
...persistedState.navigationEvents,
|
|
||||||
{
|
{
|
||||||
uri: payload.uri === undefined ? null : payload.uri,
|
uri: payload.uri === undefined ? null : payload.uri,
|
||||||
date: payload.date || new Date(),
|
date: payload.date || new Date(),
|
||||||
},
|
},
|
||||||
|
...persistedState.navigationEvents,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user