@@ -112,9 +112,9 @@ class BackendResponse {
112112 }
113113 return this . body ;
114114 }
115- async getLiveUrl ( ) {
115+ getLiveUrl ( ) {
116116 if ( undefined === this . liveUrl ) {
117- this . liveUrl = await this . response . headers . get ( 'X-Live-Url' ) ;
117+ this . liveUrl = this . response . headers . get ( 'X-Live-Url' ) ;
118118 }
119119 return this . liveUrl ;
120120 }
@@ -1805,109 +1805,7 @@ class ExternalMutationTracker {
18051805 return element . tagName === 'FONT' && element . getAttribute ( 'style' ) === 'vertical-align: inherit;' ;
18061806 }
18071807}
1808- function isValueEmpty ( value ) {
1809- if ( null === value || value === '' || undefined === value || ( Array . isArray ( value ) && value . length === 0 ) ) {
1810- return true ;
1811- }
1812- if ( typeof value !== 'object' ) {
1813- return false ;
1814- }
1815- for ( const key of Object . keys ( value ) ) {
1816- if ( ! isValueEmpty ( value [ key ] ) ) {
1817- return false ;
1818- }
1819- }
1820- return true ;
1821- }
1822- function toQueryString ( data ) {
1823- const buildQueryStringEntries = ( data , entries = { } , baseKey = '' ) => {
1824- Object . entries ( data ) . forEach ( ( [ iKey , iValue ] ) => {
1825- const key = baseKey === '' ? iKey : `${ baseKey } [${ iKey } ]` ;
1826- if ( '' === baseKey && isValueEmpty ( iValue ) ) {
1827- entries [ key ] = '' ;
1828- }
1829- else if ( null !== iValue ) {
1830- if ( typeof iValue === 'object' ) {
1831- entries = { ...entries , ...buildQueryStringEntries ( iValue , entries , key ) } ;
1832- }
1833- else {
1834- entries [ key ] = encodeURIComponent ( iValue )
1835- . replace ( / % 2 0 / g, '+' )
1836- . replace ( / % 2 C / g, ',' ) ;
1837- }
1838- }
1839- } ) ;
1840- return entries ;
1841- } ;
1842- const entries = buildQueryStringEntries ( data ) ;
1843- return Object . entries ( entries )
1844- . map ( ( [ key , value ] ) => `${ key } =${ value } ` )
1845- . join ( '&' ) ;
1846- }
1847- function fromQueryString ( search ) {
1848- search = search . replace ( '?' , '' ) ;
1849- if ( search === '' )
1850- return { } ;
1851- const insertDotNotatedValueIntoData = ( key , value , data ) => {
1852- const [ first , second , ...rest ] = key . split ( '.' ) ;
1853- if ( ! second ) {
1854- data [ key ] = value ;
1855- return value ;
1856- }
1857- if ( data [ first ] === undefined ) {
1858- data [ first ] = Number . isNaN ( Number . parseInt ( second ) ) ? { } : [ ] ;
1859- }
1860- insertDotNotatedValueIntoData ( [ second , ...rest ] . join ( '.' ) , value , data [ first ] ) ;
1861- } ;
1862- const entries = search . split ( '&' ) . map ( ( i ) => i . split ( '=' ) ) ;
1863- const data = { } ;
1864- entries . forEach ( ( [ key , value ] ) => {
1865- value = decodeURIComponent ( String ( value || '' ) . replace ( / \+ / g, '%20' ) ) ;
1866- if ( ! key . includes ( '[' ) ) {
1867- data [ key ] = value ;
1868- }
1869- else {
1870- if ( '' === value )
1871- return ;
1872- const dotNotatedKey = key . replace ( / \[ / g, '.' ) . replace ( / ] / g, '' ) ;
1873- insertDotNotatedValueIntoData ( dotNotatedKey , value , data ) ;
1874- }
1875- } ) ;
1876- return data ;
1877- }
1878- class UrlUtils extends URL {
1879- has ( key ) {
1880- const data = this . getData ( ) ;
1881- return Object . keys ( data ) . includes ( key ) ;
1882- }
1883- set ( key , value ) {
1884- const data = this . getData ( ) ;
1885- data [ key ] = value ;
1886- this . setData ( data ) ;
1887- }
1888- get ( key ) {
1889- return this . getData ( ) [ key ] ;
1890- }
1891- remove ( key ) {
1892- const data = this . getData ( ) ;
1893- delete data [ key ] ;
1894- this . setData ( data ) ;
1895- }
1896- getData ( ) {
1897- if ( ! this . search ) {
1898- return { } ;
1899- }
1900- return fromQueryString ( this . search ) ;
1901- }
1902- setData ( data ) {
1903- this . search = toQueryString ( data ) ;
1904- }
1905- }
1906- class HistoryStrategy {
1907- static replace ( url ) {
1908- history . replaceState ( history . state , '' , url ) ;
1909- }
1910- }
1808+
19111809class UnsyncedInputsTracker {
19121810 constructor ( component , modelElementResolver ) {
19131811 this . elementEventListeners = [
@@ -2255,7 +2153,7 @@ class Component {
22552153 return response ;
22562154 }
22572155 this . processRerender ( html , backendResponse ) ;
2258- const liveUrl = await backendResponse . getLiveUrl ( ) ;
2156+ const liveUrl = backendResponse . getLiveUrl ( ) ;
22592157 if ( liveUrl ) {
22602158 history . replaceState ( history . state , '' , new URL ( liveUrl + window . location . hash , window . location . origin ) ) ;
22612159 }
0 commit comments