Skip to content

Commit

Permalink
Remove fragment at all: Addressable is able to recognize it but the f…
Browse files Browse the repository at this point in the history
…ragment is never sent to the server so there's no point in try to read it.
  • Loading branch information
lucke84 committed May 1, 2016
1 parent 88a1dc9 commit e2278a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ The `railsContext` has: (see implementation in file react_on_rails_helper.rb for
port: uri.port,
pathname: uri.path, # /posts
search: uri.query, # id=30&limit=5
fragment: uri.fragment, # time=1305298413

# Locale settings
i18nLocale: I18n.locale,
Expand Down
3 changes: 1 addition & 2 deletions app/helpers/react_on_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,12 @@ def rails_context(server_side:)
result = {
# URL settings
href: request.original_url,
location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}#{uri.fragment.present? ? "##{uri.fragment}" : ''}",
location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}",
scheme: uri.scheme, # http
host: uri.host, # foo.com
port: uri.port,
pathname: uri.path, # /posts
search: uri.query, # id=30&limit=5
fragment: uri.fragment, # time=1305298413

# Locale settings
i18nLocale: I18n.locale,
Expand Down
5 changes: 2 additions & 3 deletions spec/dummy/spec/features/rails_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

background do
set_driver_header("ACCEPT-LANGUAGE", http_accept_language)
visit "/#{pathname}?ab=cd#123"
visit "/#{pathname}?ab=cd#"
end

context pathname, :js do
Expand All @@ -21,13 +21,12 @@
host_port = "#{host}:#{port}"
keys_to_vals = {
href: "http://#{host_port}/#{pathname}?ab=cd",
location: "/#{pathname}?ab=cd#123",
location: "/#{pathname}?ab=cd",
port: port,
scheme: "http",
host: host,
pathname: "/#{pathname}",
search: "ab=cd",
fragment: "123",
i18nLocale: "en",
i18nDefaultLocale: "en",
httpAcceptLanguage: http_accept_language,
Expand Down
3 changes: 1 addition & 2 deletions spec/dummy/spec/requests/server_render_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ def check_match(pathname, id_base)
top_id = "##{id_base}-react-component-0"
keys_to_vals = {
href: "http://www.example.com/#{pathname}?ab=cd",
location: "/#{pathname}?ab=cd#123",
location: "/#{pathname}?ab=cd",
scheme: "http",
host: "www.example.com",
pathname: "/#{pathname}",
search: "ab=cd",
fragment: "123",
i18nLocale: "en",
i18nDefaultLocale: "en",
httpAcceptLanguage: http_accept_language,
Expand Down

0 comments on commit e2278a0

Please sign in to comment.