File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ import moment from 'moment'
6
6
import haversine from 'haversine'
7
7
8
8
import { rememberPlace } from './map'
9
- import { queryIsValid } from '../util/state'
10
- import queryParams from '../util/query-params'
11
- import { getTripOptionsFromQuery , getUrlParams } from '../util/query'
12
9
import { hasCar } from '../util/itinerary'
10
+ import { getTripOptionsFromQuery , getUrlParams } from '../util/query'
11
+ import queryParams from '../util/query-params'
12
+ import { queryIsValid } from '../util/state'
13
+ import { randId } from '../util/storage'
13
14
if ( typeof ( fetch ) === 'undefined' ) require ( 'isomorphic-fetch' )
14
15
15
16
// Generic API actions
@@ -22,14 +23,6 @@ export const toggleTracking = createAction('TOGGLE_TRACKING')
22
23
export const rememberSearch = createAction ( 'REMEMBER_SEARCH' )
23
24
export const forgetSearch = createAction ( 'FORGET_SEARCH' )
24
25
25
- /**
26
- * Generate a random ID. This might not quite be a UUID, but it serves our
27
- * purposes for now.
28
- */
29
- function randId ( ) {
30
- return Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 )
31
- }
32
-
33
26
function formatRecentPlace ( place ) {
34
27
return {
35
28
...place ,
Original file line number Diff line number Diff line change 9
9
getUrlParams ,
10
10
planParamsToQuery
11
11
} from '../util/query'
12
- import { getItem } from '../util/storage'
12
+ import { getItem , randId } from '../util/storage'
13
13
import { queryIsValid } from '../util/state'
14
14
import { isMobile } from '../util/ui'
15
15
import {
@@ -65,8 +65,7 @@ export function parseUrlQueryString (params = getUrlParams()) {
65
65
Object . keys ( params ) . forEach ( key => {
66
66
if ( ! key . startsWith ( 'ui_' ) ) planParams [ key ] = params [ key ]
67
67
} )
68
- const searchId = params . ui_activeSearch
69
- console . log ( params , searchId )
68
+ const searchId = params . ui_activeSearch || randId ( )
70
69
// Convert strings to numbers/objects and dispatch
71
70
dispatch ( setQueryParam ( planParamsToQuery ( planParams ) , searchId ) )
72
71
}
Original file line number Diff line number Diff line change @@ -32,3 +32,11 @@ export function getItem (key, notFoundValue = null) {
32
32
export function removeItem ( key ) {
33
33
window . localStorage . removeItem ( `${ STORAGE_PREFIX } .${ key } ` )
34
34
}
35
+
36
+ /**
37
+ * Generate a random ID. This might not quite be a UUID, but it serves our
38
+ * purposes for now.
39
+ */
40
+ export function randId ( ) {
41
+ return Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 )
42
+ }
You can’t perform that action at this time.
0 commit comments