[wp-trac] [WordPress Trac] #39612: (Resolve) Error due to Backbone.History being started again

WordPress Trac noreply at wordpress.org
Sat Jan 21 18:49:06 UTC 2017


#39612: (Resolve) Error due to Backbone.History being started again
----------------------------+------------------------------
 Reporter:  tfrommen        |       Owner:  adamsilverstein
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  4.8
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:  javascript
----------------------------+------------------------------

Comment (by tfrommen):

 Replying to [comment:3 adamsilverstein]:
 >
 > > What version do '''you''' prefer? I think stopping and (re)starting
 exactly like core it needs is better than only starting if not yet
 started.
 >
 > I'm not sure.
 >
 > Can you provide some sample code or do you know of a plugin that does
 this? I'd like to test how history behaves in the 2 scenarios. my first
 instinct is the first version: only start in not started already -
 assuming history still works as expected.

 Well, when starting the history, you can only define four things that are
 ''native'': `root`, `hashChange`, `pushState` and `silent`. The first one,
 `root`, will default to `/`, and should be consistent between core,
 plugins and themes, anyway. The other three options are Booleans, and
 depending on their individual value, the ''behavior'' of the history might
 be different.

 Another thing is, that you can define custom options that will live on the
 history, for example, to be used by other parties. In this case, it is no
 problem, though, if core were to stop and then restart the history,
 because the options that will be set are not exactly what you pass to
 `start()`. Instead, you will only overwrite the values of the options you
 define yourself. In other words, if some plugins defines a custom option,
 and core stops and restarts the history, that third-party option is not
 lost. Which is good, of course.

 I would suggest that core stops and restarts the history, so this is what
 you can find in my first patch.

 Maybe someone could ''slurp'' the plugins repository to specifically check
 for  `Backbone.history.start`, or so, but I wouldn't expect lots of
 ''exotic'' stuff in that regard.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39612#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list