funcool / bide

A simple routing library for ClojureScript
BSD 2-Clause "Simplified" License
131 stars 20 forks source link

navigate! appends query when using html5 #15

Closed theasp closed 6 years ago

theasp commented 6 years ago

When using :html5? true, the query gets appended to the the URL in the browser when using navigate!. The following generates a url ending with ?show-fields=true?show-fields=false?show-fields=true?show-fields=false?show-fields=true after toggling a few times. With :html5? false it works as expected.

(defn navigate! [view params query] 
  (debugf "Navigating to: %s" {:view view :params params :query query})
  (bide/navigate! router view params query))

(defn toggle-fields-visible! [{:keys [name params query]}]
  (navigate! name params (update query :show-fields #(if (= "true" %) "false" "true"))))

The output is:

DEBUG [xxx.core:31] - Navigating to: {:view :xxx/query-table, :params {:table-name "log"}, :query {:show-fields "false"}}

Nice library!

gmp26 commented 6 years ago

Does anybody have a fix for this yet? Or should we fork and investigate?

niwinz commented 6 years ago

I havent see the isue on my projects, and i didnt have time, but if you have time plase submit a PR with a fix :D

gmp26 commented 6 years ago

Good to know that. It's possible the issue appears if the necessary server redirect isn't yet in place. We'll see shortly!

theasp commented 6 years ago

I think this might actually be fixed, I just tried :html5 true and it seems to work fine.

gmp26 commented 6 years ago

I think it’s an issue that appears in some (mis)configurations. Like others, mine now works, but was showing the problem till I revised my configuration.

M

On 10 Jun 2018, at 02:08, Andrew Phillips notifications@github.com wrote:

I think this might actually be fixed, I just tried :html5 true and it seems to work fine.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/funcool/bide/issues/15#issuecomment-396011389, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIphcZb7bvBYIyccADtu_mIngJGf39Fks5t7HGqgaJpZM4RAxR1.

-- Mike Pearson gmp26@cam.ac.uk

Winton Centre for Risk and Evidence Communication, Centre for Mathematical Sciences, Cambridge CB3 0WB

office: 01223 765921 mobile: 07426 032555

theasp commented 6 years ago

I was wrong, it's still broken for me :(

kennyjwilli commented 5 years ago

If you have :html5? true set, you will get the problem. Setting :html5 (without the ?) does not use the html5 history. This is definitely a bug.

benzap commented 4 years ago

I'm still seeing this issue. I'll look into creating a fix PR