freeanime / freeanime.tv

Fast and free anime website for browsing online embedded content
https://freeanime.tv
GNU Affero General Public License v3.0
4 stars 1 forks source link

Fix query string link integration without causing rerenders #11

Closed AndreVallestero closed 1 year ago

AndreVallestero commented 1 year ago

Actually, we might want to use solid-router's <Link> tag since it preserves middleclick functionality while not rendering the page

AndreVallestero commented 1 year ago

This should actually be a combination of setSearchParams (for queryString concatenation) and Link / A as a custom component (SoftLink).

https://github.com/solidjs/solid-router/blob/2b503ad2d65270b94f34be5d7ab348284f3d6e32/src/routing.ts#L99 https://github.com/solidjs/solid-router/blob/main/src/components.tsx#L201

AndreVallestero commented 1 year ago

The props should be (params: SetParams, options?: Partial<NavigateOptions>, very similar to setSearchParams. NavigateOptions gives us the ability to use the replace flag when needed, and default to concatenating the query string:

export interface NavigateOptions<S = unknown> {
    resolve: boolean;
    replace: boolean;
    scroll: boolean;
    state: S;
}
AndreVallestero commented 1 year ago

Resolved with https://github.com/freeanime/freeanime.tv/commit/fe01e661fa5097f49b335d3ad8847639f5b17a44