rschristian / deptree

Visualize the dependency tree of a package or project
https://deptree.rschristian.dev
MIT License
17 stars 2 forks source link

Input field: Extra leading space causes "Invalid package query" error #6

Closed aerda closed 3 months ago

aerda commented 3 months ago

Description

When pasting text into the input field, there's a risk of accidentally including an extra space at the beginning. This leads to an "Invalid package query" error.

Steps to reproduce:

  1. Copy some text.
  2. Paste the text into the input field, ensuring there's a leading space.
  3. Submit the form.
  4. Observe the "Invalid package query" error.

Expected behavior:

The input field should either:

image
rschristian commented 3 months ago

Sure, trim sounds reasonable.

Feel free to PR or I can take a look at it within the next few days, schedule permitting.

aerda commented 3 months ago

setPkgQuery( /* @type {HTMLInputElement} / (e.target).value.trim(), )

<input
    autocorrect="off"
    autocapitalize="none"
    enterkeyhint="search"
    class="py-2 px-4 w-full text(xl md:3xl center [#111]) bg-input(& dark:dark) drop-shadow-lg rounded-lg hocus:(outline(2 & primary))"
    placeholder="Provide a package name"
    value={pkgQuery}
    onInput={(e) =>
        setPkgQuery(/** @type {HTMLInputElement} */ (e.target).value)
    }
/>
aerda commented 3 months ago

Sure, trim sounds reasonable.

Feel free to PR or I can take a look at it within the next few days, schedule permitting.

remote: Permission to rschristian/deptree.git denied to aerda. fatal: unable to access 'https://github.com/rschristian/deptree.git/': The requested URL returned error: 403

rschristian commented 3 months ago

You need to fork the repo and make the changes there, you can't push directly to projects you do not own/haven't been invited to.

Here's some instructions if you're new to GitHub:

rschristian commented 3 months ago

Fixed in 4631b961bb827afba702bbee7a17b171f95b7415