MCPcopy
hub / github.com/TanStack/router / queueHistoryAction

Function queueHistoryAction

packages/history/src/index.ts:371–396  ·  view source on GitHub ↗
(
    type: 'push' | 'replace',
    destHref: string,
    state: any,
  )

Source from the content-addressed store, hash-verified

369
370 // This function queues up a call to update the browser history
371 const queueHistoryAction = (
372 type: 'push' | 'replace',
373 destHref: string,
374 state: any,
375 ) => {
376 const href = createHref(destHref)
377
378 if (!scheduled) {
379 rollbackLocation = currentLocation
380 }
381
382 // Update the location in memory
383 currentLocation = parseHref(destHref, state)
384
385 // Keep track of the next location we need to flush to the URL
386 next = {
387 href,
388 state,
389 isPush: next?.isPush || type === 'push',
390 }
391
392 if (!scheduled) {
393 // Schedule an update to the browser history
394 scheduled = Promise.resolve().then(() => flush())
395 }
396 }
397
398 // NOTE: this function can probably be removed
399 const onPushPop = (type: 'PUSH' | 'REPLACE') => {

Callers 1

createBrowserHistoryFunction · 0.85

Calls 4

parseHrefFunction · 0.85
flushFunction · 0.85
resolveMethod · 0.80
thenMethod · 0.65

Tested by

no test coverage detected