Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#38592 closed defect (bug) (fixed)

Customizer preview fails to persist state query params through history.pushState() calls

Reported by: westonruter Owned by: westonruter
Priority: normal Milestone: 4.7
Component: Customize Version:
Severity: normal Keywords:
Cc: Focuses:

Description

There is a typo in [38810] for #30937 where the injectUrlWithState method fails to return the new state URL that is mutated. It is capturing the state data but it is not ensuring the URL gets the state params.

Also, if the history.pushState() or history.replaceState() call is done before the preview-ready event triggers, then a JS error is likely to result because wp.customize.settings would not be defined yet. It is unnecessary to define anyway because the query params are in the URL to begin with anyway.

Change History (1)

#1 @westonruter
10 years ago

  • Owner set to westonruter
  • Resolutionfixed
  • Status newclosed

In 39060:

Customize: Ensure state query params persist in preview through calls to history.pushState() & history.replaceState().

Allow history to be manipulated before DOM ready by sourcing state params from the current URL instead of from the wp.customize.settings object, since they will be the same anyway. This fixes a JS error since wp.customize.settings is not defined before DOM ready.

Amends [38810].
See #30937.
Fixes #38592.

Note: See TracTickets for help on using tickets.