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:
Benjamin Elo
2019-07-22 03:03:14 -07:00
committed by Facebook Github Bot
parent 9b82dc5025
commit aeee96c050
2 changed files with 2 additions and 2 deletions

View File

@@ -74,11 +74,11 @@ test('add incoming nav event to persisted state with nav events', () => {
INCOMING_NAV_EVENT,
);
expect(newPersistedState.navigationEvents).toEqual([
...persistedState.navigationEvents,
{
uri: 'mock://this_is_a_mock_uri/mock',
date: DATE_MOCK_1,
},
...persistedState.navigationEvents,
]);
} else {
expect(reducer).not.toBeNull();

View File

@@ -42,11 +42,11 @@ export default class extends FlipperPlugin<State, {}, PersistedState> {
return {
...persistedState,
navigationEvents: [
...persistedState.navigationEvents,
{
uri: payload.uri === undefined ? null : payload.uri,
date: payload.date || new Date(),
},
...persistedState.navigationEvents,
],
};
default: