reactive-router 0.7.10 → 0.7.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64e530a6af47e431072eb9b1f0885fbd1dff9485
4
- data.tar.gz: a5d4b3a61c4ca4b4a75342fc1ee00cfff363a1c2
3
+ metadata.gz: c9e13f32bcb8346671dbb38dac2ebf5a2365bcab
4
+ data.tar.gz: 96a5ecc6d7c25a3b6980564aedbe86e7939a9053
5
5
  SHA512:
6
- metadata.gz: bd05f416e8963820d59dbd67198298b5748741838b33e111622e34c897b30db6cae4543dbf5daf9ae05064bc94e89dac5add666076811ef426da9b6d7f746563
7
- data.tar.gz: 8379a56770fd5cbb305401df4c5b8b79d4fb0b33e08f1818b46921b0db8475b16378be3ace4160931212b667b3d5e502f0713d97398a21be98f9da48cc572d05
6
+ metadata.gz: 7c178788272d94fc46bade0dc418ea910f824284f972463a8db2dd53e39458267eae83b9dade865c17bd436eba36ef575f16a8b2955dab283338baa6b34f9706
7
+ data.tar.gz: 245189488f47aeeb4d086a470dda6dcec13a45a0139b35a8f6cabe8026c4946ff0d7ce41be33fe14ce297c9f5b968bc2fd7e30aa597336d9f65ee5f29ebc5abf
@@ -35,6 +35,9 @@ class History
35
35
  if `event.state == null` # happens when popping off outer dialog
36
36
  puts "pop handler pops off last value"
37
37
  old_history = @history
38
+ @saved_history = @history # for safari's sake
39
+ @saved_path = @current_path
40
+ @saved_history_length = `ReactRouter.History.length`
38
41
  @current_path = ""
39
42
  @history = nil
40
43
  `ReactRouter.History.length = 0`
@@ -61,6 +64,12 @@ class History
61
64
 
62
65
  def push_path(path)
63
66
  puts "pushing path #{path}"
67
+ unless @history # needed because safari strangly pops off outer most history on initialization
68
+ @history = @saved_history
69
+ @current_path = @saved_path
70
+ `ReactRouter.History.length = #{@saved_history_length}`
71
+ @history.on_state_change.call(:active) if @history.on_state_change
72
+ end
64
73
  `window.history.pushState({ path: path, history_id: #{@history.name}, history_length: (ReactRouter.History.length += 1)}, '', path);`
65
74
  @current_path = path
66
75
  @history.notify_listeners(:push)
@@ -68,6 +77,12 @@ class History
68
77
 
69
78
  def replace_path(path)
70
79
  puts "replacing path #{path}"
80
+ unless @history # needed because safari strangly pops off outer most history on initialization
81
+ @history = @saved_history
82
+ @current_path = @saved_path
83
+ `ReactRouter.History.length = #{@saved_history_length}`
84
+ @history.on_state_change.call(:active) if @history.on_state_change
85
+ end
71
86
  `window.history.replaceState({ path: path, history_id: #{@history.name}, history_length: ReactRouter.History.length}, '', path);`
72
87
  @current_path = path
73
88
  @history.notify_listeners(:replace)
@@ -115,7 +130,11 @@ class History
115
130
  current_history = self.class.history
116
131
  self.class.history = self
117
132
  @starting_history_length = `ReactRouter.History.length` if current_history != self
118
- self.class.push_path initial_path
133
+ if @name == "MainApp"
134
+ self.class.replace_path initial_path
135
+ else
136
+ self.class.push_path initial_path
137
+ end
119
138
  @on_state_change.call(:active) if @on_state_change and current_history != self
120
139
  self
121
140
  end
@@ -127,8 +146,11 @@ class History
127
146
  end
128
147
 
129
148
  def notify_listeners(type)
130
- puts "#{self}.notify_listeners(#{type}) listeners_count: #{@listeners.count}, path: #{self.class.current_path}"
149
+ puts "!! #{self}.notify_listeners(#{type}) listeners_count: #{@listeners.count}, path: #{self.class.current_path}"
131
150
  @listeners.each { |listener| `listener.call(#{@location}, {path: #{self.class.current_path}, type: type})` }
151
+ rescue Exception => e
152
+ `debugger`
153
+ nil
132
154
  end
133
155
 
134
156
 
@@ -164,7 +164,7 @@ module React
164
164
  # override self.location to provide application specific location handlers
165
165
 
166
166
  def location
167
- (@location ||= History.new("MainApp")).activate.location
167
+ (@location ||= History.new("MainApp")).activate.location # must be called MainApp for now to avoid doing an extra state push (ugh)
168
168
  end
169
169
 
170
170
  after_mount do
@@ -1,3 +1,3 @@
1
1
  module ReactiveRouter
2
- VERSION = "0.7.10"
2
+ VERSION = "0.7.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactive-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.10
4
+ version: 0.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam George
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-09 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler