mirror of
https://codeberg.org/MarkusThielker/next-ory.git
synced 2025-04-10 11:58:41 +00:00
NORY-45: fix search input value lost on reload
This commit is contained in:
parent
19e68b8929
commit
5e01a7f50f
2 changed files with 7 additions and 2 deletions
|
@ -29,7 +29,10 @@ export default async function UserPage(
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<SearchInput queryParamKey="query" placeholder="Search for identifiers (Email, Username...)"/>
|
<SearchInput
|
||||||
|
value={query}
|
||||||
|
queryParamKey="query"
|
||||||
|
placeholder="Search for identifiers (Email, Username...)"/>
|
||||||
<IdentityDataTable
|
<IdentityDataTable
|
||||||
data={initialData}
|
data={initialData}
|
||||||
page={page}
|
page={page}
|
||||||
|
|
|
@ -5,13 +5,14 @@ import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { ChangeEvent, HTMLInputTypeAttribute } from 'react';
|
import { ChangeEvent, HTMLInputTypeAttribute } from 'react';
|
||||||
|
|
||||||
interface SearchInputProps {
|
interface SearchInputProps {
|
||||||
|
value: string;
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
queryParamKey: string;
|
queryParamKey: string;
|
||||||
type?: HTMLInputTypeAttribute;
|
type?: HTMLInputTypeAttribute;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SearchInput({ placeholder, queryParamKey, type, className }: SearchInputProps) {
|
export function SearchInput({ value, placeholder, queryParamKey, type, className }: SearchInputProps) {
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useSearchParams();
|
const params = useSearchParams();
|
||||||
|
@ -32,6 +33,7 @@ export function SearchInput({ placeholder, queryParamKey, type, className }: Sea
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
|
value={value}
|
||||||
type={type ?? 'text'}
|
type={type ?? 'text'}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
className={className}
|
className={className}
|
||||||
|
|
Loading…
Add table
Reference in a new issue