Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix warnings after minor dep bump
Rūdolfs Ošiņš committed 29 days ago
commit bb7cda92d523d8beba0dc29cd1d469f1612543e5
parent d3363aae96edb8b5f9c23be47a136c5f40bcdcf2
16 files changed +72 -54
modified src/components/Changes.svelte
@@ -25,7 +25,11 @@
  let hideChanges = $state(false);
  let filesExpanded = $state(true);
  let selectedCommit = $state<string>();
+
  // Parent reuses this component across patch revisions; a sibling $effect
+
  // resets base and head when patchId changes.
+
  // svelte-ignore state_referenced_locally
  let base = $state(revision.base);
+
  // svelte-ignore state_referenced_locally
  let head = $state(revision.head);

  $effect(() => {
modified src/components/CommentToggleInput.svelte
@@ -28,11 +28,9 @@
  }: Props = $props();
  /* eslint-enable prefer-const */

-
  let state: "collapsed" | "expanded" | "submit" | undefined = $state();
-

-
  $effect(() => {
-
    state = onclose !== undefined ? "expanded" : "collapsed";
-
  });
+
  let state: "collapsed" | "expanded" | "submit" | undefined = $derived(
+
    onclose !== undefined ? "expanded" : "collapsed",
+
  );
</script>

<style>
modified src/components/Diff.svelte
@@ -203,7 +203,7 @@
    }
  }

-
  let threadExpandedStates: Record<string, boolean> = $state(
+
  const threadExpandedStates: Record<string, boolean> = $derived(
    codeComments
      ? Object.fromEntries(
          codeComments.threads.map(t => [t.root.id, t.root.resolved]),
@@ -211,14 +211,6 @@
      : {},
  );

-
  $effect(() => {
-
    threadExpandedStates = codeComments
-
      ? Object.fromEntries(
-
          codeComments.threads.map(t => [t.root.id, t.root.resolved]),
-
        )
-
      : {};
-
  });
-

  function toggleCommentExpand(commentId: string) {
    threadExpandedStates[commentId] = !threadExpandedStates[commentId];
  }
@@ -333,6 +325,7 @@
    class:context={line.type === "context"}
    class:selected={!thread &&
      isSelected(filePath(file, "left"), hunkIdx, lineIdx)}>
+
    <!-- svelte-ignore a11y_no_static_element_interactions -->
    <div
      class="left"
      class:selection-disabled={!codeComments || thread}
@@ -346,6 +339,7 @@
      {lineNumber(line, "left")}
    </div>

+
    <!-- svelte-ignore a11y_no_static_element_interactions -->
    <div
      class="right"
      class:selection-disabled={!codeComments || thread}
@@ -452,6 +446,7 @@
  {/if}

  {#if codeComments && selection?.hunkIdx === hunkIdx && selection?.lineIdx === lineIdx}
+
    <!-- svelte-ignore a11y_no_static_element_interactions -->
    <div
      class="comment-form"
      onpointerdown={e => {
modified src/components/Discussion.svelte
@@ -50,22 +50,19 @@
  }: Props = $props();
  /* eslint-enable prefer-const */

-
  let previousCobId = cobId;
+
  let previousCobId: string | undefined;
  let focusReply: boolean = $state(false);
  let commentFormKey = $state(0);

  let hideDiscussion = $state(false);

  $effect(() => {
-
    // eslint-disable-next-line @typescript-eslint/no-unused-expressions
-
    cobId;
-

-
    if (cobId !== previousCobId) {
-
      previousCobId = cobId;
+
    if (previousCobId !== undefined && cobId !== previousCobId) {
      hideDiscussion = false;
      focusReply = false;
      commentFormKey += 1;
    }
+
    previousCobId = cobId;
  });
</script>

modified src/components/ExtendedTextarea.svelte
@@ -7,6 +7,7 @@
  import { open } from "@tauri-apps/plugin-dialog";
  import debounce from "lodash/debounce";
  import { onDestroy, onMount } from "svelte";
+
  import { SvelteMap } from "svelte/reactivity";

  import { invoke } from "@app/lib/invoke";
  import * as utils from "@app/lib/utils";
@@ -63,7 +64,7 @@
    focus = false,
    inline = false,
    body = $bindable(""),
-
    embeds = new Map(),
+
    embeds = new SvelteMap<string, Embed>(),
    submitInProgress = false,
    disableSubmit = false,
    disallowEmptyBody = false,
modified src/components/NotificationTeaser.svelte
@@ -52,9 +52,9 @@
        (a, b) =>
          Boolean(
            a.oid === b.oid &&
-
              a.type === b.type &&
-
              a.author.did &&
-
              b.author.did,
+
            a.type === b.type &&
+
            a.author.did &&
+
            b.author.did,
          ),
      ).sort((a, b) => b.timestamp - a.timestamp),
      kind,
modified src/components/Review.svelte
@@ -96,6 +96,9 @@
        }, [])) as Thread<CodeLocation>[]) || [],
  );

+
  // The verdict prop seeds a local working copy that the form mutates until
+
  // submit; later prop updates intentionally do not overwrite it.
+
  // svelte-ignore state_referenced_locally
  let verdict: Review["verdict"] = $state(review.verdict);

  async function editReview(
modified src/components/ScrollArea.svelte
@@ -41,13 +41,15 @@
    return el.scrollTop + el.clientHeight >= el.scrollHeight - threshold;
  }

-
  const scrollHalfHandler = onScrollHalf
-
    ? (instance: Parameters<typeof shouldLoadMore>[0]) => {
-
        if (shouldLoadMore(instance)) {
-
          onScrollHalf();
+
  const scrollHalfHandler = $derived(
+
    onScrollHalf
+
      ? (instance: Parameters<typeof shouldLoadMore>[0]) => {
+
          if (shouldLoadMore(instance)) {
+
            onScrollHalf();
+
          }
        }
-
      }
-
    : undefined;
+
      : undefined,
+
  );
</script>

<OverlayScrollbarsComponent
modified src/components/SidebarRepoList.svelte
@@ -36,22 +36,14 @@
    activeRepo = undefined,
  }: Props = $props();

-
  let repos = $state<RepoSummary[]>(initialRepos);
-
  let seededNotReplicated = $state<string[]>(initialSeededNotReplicated);
+
  let repos: RepoSummary[] = $derived(initialRepos);
+
  let seededNotReplicated: string[] = $derived(initialSeededNotReplicated);
  let activeCommitCount = $state<number | undefined>(undefined);
  let filterOpen = $state(false);
  let filterQuery = $state("");
  let filterInputElement: HTMLInputElement | undefined = $state(undefined);

  $effect(() => {
-
    repos = initialRepos;
-
  });
-

-
  $effect(() => {
-
    seededNotReplicated = initialSeededNotReplicated;
-
  });
-

-
  $effect(() => {
    const rid = activeRepo?.rid;
    const head = activeRepo?.payloads["xyz.radicle.project"]?.meta.head;

modified src/modals/Guide.svelte
@@ -113,8 +113,7 @@
          <button onclick={() => show({ component: SettingsView, props: {} })}>
            Settings
          </button>
-
          and enable 'Notify on new versions' to receive notifications about new
-
          releases.
+
          and enable 'Notify on new versions' to receive notifications about new releases.
        </div>

        {#if !radicleInstalled() && !$nodeRunning}
modified src/views/Inbox.svelte
@@ -21,7 +21,9 @@
  let { sidebarData, notificationsByRepo }: Props = $props();
  /* eslint-enable prefer-const */

-
  notificationCount.value = sidebarData.notificationCount;
+
  $effect(() => {
+
    notificationCount.value = sidebarData.notificationCount;
+
  });

  async function updateCount() {
    const count = await invoke<number>("notification_count");
modified src/views/repo/Issue.svelte
@@ -64,7 +64,13 @@
  }: Props = $props();
  /* eslint-enable prefer-const */

+
  // Parent reuses this component across issue navigations; a sibling $effect
+
  // resets local state when issue.id changes.
+
  // svelte-ignore state_referenced_locally
  let issues = $state(initialIssues);
+
  // The initial status filter is captured at mount so it stays fixed while
+
  // navigating between sibling issues.
+
  // svelte-ignore state_referenced_locally
  const status = initialStatus;
  let labelSaveInProgress: boolean = $state(false);
  let assigneesSaveInProgress: boolean = $state(false);
modified src/views/repo/Patch.svelte
@@ -63,10 +63,17 @@
  /* eslint-enable prefer-const */

  let hideTimeline = $state(true);
+
  // The initial status filter is captured at mount so it stays fixed while
+
  // navigating between sibling patches.
+
  // svelte-ignore state_referenced_locally
  const status = initialStatus;
+
  // Parent reuses this component across patch navigations; a sibling $effect
+
  // resets tab and selectedRevision when patch.id changes.
+
  // svelte-ignore state_referenced_locally
  let tab: "patch" | "revisions" | "timeline" = $state(
    revisions.length > 1 ? "revisions" : "patch",
  );
+
  // svelte-ignore state_referenced_locally
  let selectedRevision: Revision = $state(revisions.slice(-1)[0]);

  $effect(() => {
modified src/views/repo/Patches.svelte
@@ -37,8 +37,13 @@

  const { repo, patches, status }: Props = $props();

+
  // Parent reuses this component across status filter changes; a sibling
+
  // $effect resets pagination state when the patches prop changes.
+
  // svelte-ignore state_referenced_locally
  let items = $state(patches.content);
+
  // svelte-ignore state_referenced_locally
  let cursor = patches.cursor;
+
  // svelte-ignore state_referenced_locally
  let more = patches.more;

  const project = $derived(repo.payloads["xyz.radicle.project"]!);
modified src/views/repo/RepoCommits.svelte
@@ -50,7 +50,11 @@
    commits: Commit[];
  };

+
  // Parent reuses this component across navigations; a sibling $effect resets
+
  // pagination state when the commits prop changes.
+
  // svelte-ignore state_referenced_locally
  let items = $state(commits.content);
+
  // svelte-ignore state_referenced_locally
  let more = $state(commits.more);
  let loadingMore = $state(false);
  let loading = $state(false);
@@ -113,8 +117,11 @@
  function dayLabel(timestamp: number) {
    const date = new Date(timestamp);
    const today = new Date();
-
    const yesterday = new Date();
-
    yesterday.setDate(today.getDate() - 1);
+
    const yesterday = new Date(
+
      today.getFullYear(),
+
      today.getMonth(),
+
      today.getDate() - 1,
+
    );

    if (dayKey(date.getTime()) === dayKey(today.getTime())) {
      return "Today";
@@ -151,25 +158,25 @@
  const filteredCommits = $derived(searchResults.map(r => r.obj.commit));

  const groupedCommits = $derived.by<CommitGroup[]>(() => {
-
    const groups = new Map<string, CommitGroup>();
+
    const groups: Record<string, CommitGroup> = {};

    for (const commit of filteredCommits) {
      const timestamp = commit.committer.time * 1000;
      const key = dayKey(timestamp);
-
      const current = groups.get(key);
+
      const current = groups[key];

      if (current) {
        current.commits.push(commit);
      } else {
-
        groups.set(key, {
+
        groups[key] = {
          key,
          label: dayLabel(timestamp),
          commits: [commit],
-
        });
+
        };
      }
    }

-
    return [...groups.values()];
+
    return Object.values(groups);
  });
</script>

modified src/views/repo/RepoHome.svelte
@@ -34,7 +34,6 @@

  let currentPath = $state("");
  let codeElement: HTMLElement | undefined = $state();
-
  let preview = $state(true);
  let error: InvokeError | undefined = $state();

  $effect(() => {
@@ -77,10 +76,11 @@
    }
  });

-
  $effect(() => {
-
    preview = isMarkdownPath(currentPath);
-
  });
+
  let preview = $derived(isMarkdownPath(currentPath));

+
  // Parent reuses this component across routes; a sibling $effect resets blob
+
  // when the readme prop changes, and fetchBlob mutates it during navigation.
+
  // svelte-ignore state_referenced_locally
  let blob: Blob | Readme | null = $state(readme);
  const showLineNumbers = $derived(
    blob && !blob.binary && blob.content.trim() !== "" && !preview && !error,