mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-19 20:11:31 +02:00
fix make search relay default
This commit is contained in:
@@ -21,7 +21,7 @@ import { CloseIcon } from "@chakra-ui/icons";
|
|||||||
import BackButton from "../../../components/router/back-button";
|
import BackButton from "../../../components/router/back-button";
|
||||||
import useUserSearchRelayList from "../../../hooks/use-user-search-relay-list";
|
import useUserSearchRelayList from "../../../hooks/use-user-search-relay-list";
|
||||||
import useCurrentAccount from "../../../hooks/use-current-account";
|
import useCurrentAccount from "../../../hooks/use-current-account";
|
||||||
import { getRelaysFromList, listAddRelay, listRemoveRelay } from "../../../helpers/nostr/lists";
|
import { cloneList, getRelaysFromList, listAddRelay, listRemoveRelay } from "../../../helpers/nostr/lists";
|
||||||
import { usePublishEvent } from "../../../providers/global/publish-provider";
|
import { usePublishEvent } from "../../../providers/global/publish-provider";
|
||||||
import { RelayFavicon } from "../../../components/relay-favicon";
|
import { RelayFavicon } from "../../../components/relay-favicon";
|
||||||
import AddRelayForm from "../app/add-relay-form";
|
import AddRelayForm from "../app/add-relay-form";
|
||||||
@@ -98,7 +98,7 @@ export default function SearchRelaysView() {
|
|||||||
|
|
||||||
const makeDefault = async (url: string) => {
|
const makeDefault = async (url: string) => {
|
||||||
try {
|
try {
|
||||||
const draft = searchRelayList || emptySearchRelayList();
|
const draft = searchRelayList ? cloneList(searchRelayList) : emptySearchRelayList();
|
||||||
draft.tags = Array.from(draft.tags).sort((a, b) => (a[1] === url ? -1 : 1));
|
draft.tags = Array.from(draft.tags).sort((a, b) => (a[1] === url ? -1 : 1));
|
||||||
await publish("Set default search relay", draft);
|
await publish("Set default search relay", draft);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Reference in New Issue
Block a user