boring-router-react
Advanced tools
Comparing version 0.3.0-alpha.35 to 0.3.0-alpha.36
@@ -26,2 +26,3 @@ import { AbstractHistory, HistorySnapshot } from 'boring-router'; | ||
constructor({ prefix, hash }?: BrowserHistoryOptions); | ||
readonly ref: string; | ||
private readonly hashPrefix; | ||
@@ -28,0 +29,0 @@ getHRefByRef(ref: string): string; |
@@ -52,2 +52,5 @@ "use strict"; | ||
} | ||
get ref() { | ||
return boring_router_1.getActiveHistoryEntry(this.snapshot).ref; | ||
} | ||
get hashPrefix() { | ||
@@ -88,2 +91,5 @@ return `${location.pathname}${location.search}`; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
if (ref === this.ref) { | ||
return this.replace(ref, data); | ||
} | ||
yield this.restoringPromise; | ||
@@ -90,0 +96,0 @@ let snapshot = this.pushEntry({ |
@@ -1,8 +0,7 @@ | ||
import { RouteMatch } from 'boring-router'; | ||
import { RouteMatch, RouteMatchSharedToParamDict } from 'boring-router'; | ||
import { Component, HTMLAttributes, ReactNode } from 'react'; | ||
import { EmptyObjectPatch } from 'tslang'; | ||
export interface LinkProps<TRouteMatch extends RouteMatch> extends HTMLAttributes<HTMLAnchorElement> { | ||
className?: string; | ||
to: TRouteMatch; | ||
params?: TRouteMatch extends RouteMatch<infer TParamDict> ? Partial<TParamDict> & EmptyObjectPatch : never; | ||
params?: RouteMatchSharedToParamDict<TRouteMatch>; | ||
replace?: boolean; | ||
@@ -9,0 +8,0 @@ toggle?: boolean; |
@@ -44,3 +44,3 @@ "use strict"; | ||
try { | ||
this.href = to.$href(params); | ||
this.href = to.$router.$(to, params).$href(); | ||
} | ||
@@ -47,0 +47,0 @@ catch (error) { |
{ | ||
"name": "boring-router-react", | ||
"version": "0.3.0-alpha.35", | ||
"version": "0.3.0-alpha.36", | ||
"description": "A light-weight, type-safe, yet reactive router service using MobX.", | ||
@@ -41,3 +41,3 @@ "repository": { | ||
}, | ||
"gitHead": "6f117e59ef34354bc4356a9dfbb3a5da4bfcfb25" | ||
"gitHead": "f13e5c9589a987a1697772efeff1fddea17a9e28" | ||
} |
@@ -5,2 +5,3 @@ import { | ||
HistorySnapshot, | ||
getActiveHistoryEntry, | ||
getActiveHistoryEntryIndex, | ||
@@ -75,2 +76,6 @@ isHistoryEntryEqual, | ||
get ref(): string { | ||
return getActiveHistoryEntry(this.snapshot).ref; | ||
} | ||
private get hashPrefix(): string { | ||
@@ -113,2 +118,6 @@ return `${location.pathname}${location.search}`; | ||
async push(ref: string, data?: TData): Promise<void> { | ||
if (ref === this.ref) { | ||
return this.replace(ref, data); | ||
} | ||
await this.restoringPromise; | ||
@@ -115,0 +124,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
46023
27
887
0