Skip to content

Commit

Permalink
Do not trigger onUrlChanged when the component mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaid-Ajaj committed Jan 28, 2020
1 parent 15d5bf5 commit 9da1d67
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ segment "#/users/1/details" => [ "users"; "1"; "details" ]
segment "#/users?id=1" => [ "users"; "?id=1" ]
segment "#/home/users?id=1" => [ "home"; "users"; "?id=1" ]
segment "#/users?id=1&format=json" => [ "users"; "?id=1&format=json" ]
// escaped query string parameters are decoded when the url is segmented
segment @"#/search?q=whats%20up" => [ "search"; "?q=whats%20up" ]
```

### Parsing URL segments into `Page` definitions
Expand Down
4 changes: 2 additions & 2 deletions src/Feliz.Router.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<PackageIconUrl></PackageIconUrl>
<PackageTags>fsharp;fable;react;html;router;routing</PackageTags>
<Authors>Zaid Ajaj</Authors>
<Version>1.8.0</Version>
<Version>1.8.1</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReleaseNotes>Added Router.currentUrl()</PackageReleaseNotes>
<PackageReleaseNotes>Do not trigger onUrlChanged when the component mounts</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<Compile Include="Router.fs" />
Expand Down
6 changes: 0 additions & 6 deletions src/Router.fs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ type RouterComponent(props: RouterProperties) =
window.addEventListener("popstate", unbox onChange)
// listen to custom navigation events published by `Router.navigate()`
window.addEventListener(Router.customNavigationEvent, unbox onChange)
// trigger event here
onChange()

override this.componentWillUnmount() =
// clean up when the router isn't in view anymore
Expand Down Expand Up @@ -178,10 +176,6 @@ type Router =
/// `segment "#/home/users?id=1" => [ "home"; "users"; "?id=1" ]`
///
/// `segment "#/users?id=1&format=json" => [ "users"; "?id=1&format=json" ]`
///
/// escaped query string parameters are decoded when the url is segmented
///
/// `segment @"#/search?q=whats%20up" => [ "search"; "?q=whats up" ]`
static member onUrlChanged (eventHandler: string list -> unit) : IRouterProperty = unbox ("onUrlChanged", eventHandler)

/// The element that is rendered inside where the `router` is placed. Usually this contains the root application but it could also be part of another root element.
Expand Down

0 comments on commit 9da1d67

Please sign in to comment.