kriasoft / universal-router

A simple middleware-style router for isomorphic JavaScript web apps
https://www.kriasoft.com/universal-router/
MIT License
1.7k stars 105 forks source link

generateUrls() does not work with universal-router/sync #171

Closed ezzatron closed 4 years ago

ezzatron commented 4 years ago

I'm submitting a ...

This is pretty easy to replicate:

import UniversalRouterSync from 'universal-router/sync'
import generateUrls from 'universal-router/generateUrls'

const router = new UniversalRouter([])
const url = generateUrls(router)

The above code throws an error with the message An instance of UniversalRouter is expected.

Looking at the source it's pretty easy to understand why. The implementation of generateUrls() checks explicitly for instanceof UniversalRouter, and UniversalRouterSync does not inherit from UniversalRouter.

frenzzy commented 4 years ago

Thank you for the bug report! The fix is released: v8.3.0 🎉

ezzatron commented 4 years ago

Thanks for the quick fix!