funcool / bide

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

TypeError: null is not an object (evaluating '= this.hiddenInput_.value = token') #6

Closed ghost closed 7 years ago

ghost commented 7 years ago

everytime I use navigate! I get the following error entry in the browser console:

TypeError: null is not an object (evaluating '= this.hiddenInput_.value = token') history.js:899
update_ history.js:899
check_ history.js:871
setHistoryState_ history.js:682
setToken history.js:621
(anonymous function) core.js:316
bide$core$_navigare core.js:16

it does not break things, but clutters the console output.

it seems that this 'hiddenInput' thing is specific to goog.History Is there a reason why bide does not use goog.HTML5History?

niwinz commented 7 years ago

html5 is not used by default just because it mutates directly the url (not the uri fragment), that implies that if the user refreshes the page will get the 404 response unless the server is properly configured to return the "index.html" on all uris.

On the other hand, would be awesome have the ability to switch the implementation for users that want/need to use html5 history.

However, this error is pretty strange, I'm using bide in many projects and don't notice similar exceptions in console.

ghost commented 7 years ago

in this pull request for pushy https://github.com/kibu-australia/pushy/pull/21/commits/88cbb28ff5ad4ce9c06df2efbaa60f8e40608188 fragment support is added for HTML5History, so it does not seem impossible

an alternative would be to split-off the history part (make bide only for routing) and let users decide if they want to use History or HTML5History by using an add-on (such as pushy)?

regarding the error, it could be that my browser (qutebrowser) is old (webkit engine). I'll try with webengine, if the error does not show up there I rename this issue to HTML5History suppport :)

ghost commented 7 years ago
niwinz commented 7 years ago

I have pushed on master (and 1.3.0-SNAPSHOT) with html5 support. It can be enabled passing :html5 true to the opts to start! function. From now, bide uses Html5History instead of History for all cases (with and without fragment).

ghost commented 7 years ago

works, error in console is gone!