QwikDev / qwik-evolution

Home for Qwik proposals and RFCs
15 stars 0 forks source link

[✨] qwik-city: useLocation should provide makePath #58

Closed wmertens closed 1 month ago

wmertens commented 1 year ago

Is your feature request related to a problem?

When trying to redirect within the application, it's hard to do it properly.

Describe the solution you'd like

useLocation should return makePath function that takes path and/or params and/or query, merging those to return the correct absolute path for the application.

const {makePath, params} = useLocation()
return <div>
  <Link href={makePath({path:".."})}>Up</Link>
  <Link href={makePath({params: {id: Number(params.id)-1}})}>Previous</Link>
</div>

Describe alternatives you've considered

Adhoc path generation. People will often forget query strings and the base path

Additional context

No response

manucorporat commented 1 year ago

I don't think this belong in useLocation()

wmertens commented 1 year ago

@manucorporat is it because it would create overhead? How about a useMakePath() hook that calls useLocation?

gioboa commented 1 month ago

We moved this issue to qwik-evolution repo to create a RFC discussion for this. Here is our Qwik RFC process thanks.