fix: column lose state when navigate back
This commit is contained in:
@@ -23,11 +23,7 @@ export const Route = createFileRoute("/create-group")({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function Screen() {
|
function Screen() {
|
||||||
const contacts = Route.useLoaderData();
|
|
||||||
const navigate = Route.useNavigate();
|
|
||||||
|
|
||||||
const { ark } = Route.useRouteContext();
|
const { ark } = Route.useRouteContext();
|
||||||
const { label, redirect } = Route.useSearch();
|
|
||||||
|
|
||||||
const [title, setTitle] = useState("");
|
const [title, setTitle] = useState("");
|
||||||
const [npub, setNpub] = useState("");
|
const [npub, setNpub] = useState("");
|
||||||
@@ -36,6 +32,10 @@ function Screen() {
|
|||||||
]);
|
]);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
const contacts = Route.useLoaderData();
|
||||||
|
const search = Route.useSearch();
|
||||||
|
const navigate = Route.useNavigate();
|
||||||
|
|
||||||
const toggleUser = (pubkey: string) => {
|
const toggleUser = (pubkey: string) => {
|
||||||
setUsers((prev) =>
|
setUsers((prev) =>
|
||||||
prev.includes(pubkey)
|
prev.includes(pubkey)
|
||||||
@@ -56,11 +56,11 @@ function Screen() {
|
|||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const key = `lume_group_${label}`;
|
const key = `lume_group_${search.label}`;
|
||||||
const createGroup = await ark.set_nstore(key, JSON.stringify(users));
|
const createGroup = await ark.set_nstore(key, JSON.stringify(users));
|
||||||
|
|
||||||
if (createGroup) {
|
if (createGroup) {
|
||||||
return navigate({ to: redirect });
|
return navigate({ to: search.redirect, search: { ...search } });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ export const Route = createFileRoute("/create-topic")({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function Screen() {
|
function Screen() {
|
||||||
const { label, redirect } = Route.useSearch();
|
|
||||||
const { ark } = Route.useRouteContext();
|
const { ark } = Route.useRouteContext();
|
||||||
|
|
||||||
const [topics, setTopics] = useState<Topic[]>([]);
|
const [topics, setTopics] = useState<Topic[]>([]);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
|
const search = Route.useSearch();
|
||||||
const navigate = Route.useNavigate();
|
const navigate = Route.useNavigate();
|
||||||
|
|
||||||
const toggleTopic = (topic: Topic) => {
|
const toggleTopic = (topic: Topic) => {
|
||||||
@@ -38,11 +38,11 @@ function Screen() {
|
|||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const key = `lume_topic_${label}`;
|
const key = `lume_topic_${search.label}`;
|
||||||
const createTopic = await ark.set_nstore(key, JSON.stringify(topics));
|
const createTopic = await ark.set_nstore(key, JSON.stringify(topics));
|
||||||
|
|
||||||
if (createTopic) {
|
if (createTopic) {
|
||||||
return navigate({ to: redirect });
|
return navigate({ to: search.redirect, search: { ...search } });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -109,7 +109,13 @@ pub async fn get_local_events(
|
|||||||
};
|
};
|
||||||
let authors: Vec<PublicKey> = pubkeys
|
let authors: Vec<PublicKey> = pubkeys
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|p| PublicKey::from_hex(p).unwrap())
|
.map(|p| {
|
||||||
|
if p.starts_with("npub1") {
|
||||||
|
PublicKey::from_bech32(p).unwrap()
|
||||||
|
} else {
|
||||||
|
PublicKey::from_hex(p).unwrap()
|
||||||
|
}
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let filter = Filter::new()
|
let filter = Filter::new()
|
||||||
.kinds(vec![Kind::TextNote, Kind::Repost])
|
.kinds(vec![Kind::TextNote, Kind::Repost])
|
||||||
|
|||||||
Reference in New Issue
Block a user