@mhosaic/feedback 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1807,6 +1807,7 @@ function StatusHistorySection({ rows, strings }) {
1807
1807
  // src/widget/BoardView.tsx
1808
1808
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs4 } from "preact/jsx-runtime";
1809
1809
  var POLL_MS2 = 3e4;
1810
+ var SEARCH_DEBOUNCE_MS = 300;
1810
1811
  var SORT_OPTIONS = ["recent", "oldest", "updated", "severity", "status"];
1811
1812
  var STATUSES = [
1812
1813
  "new",
@@ -1836,6 +1837,22 @@ function BoardView({
1836
1837
  const [selectedId, setSelectedId] = useState2(initialSelectedId ?? null);
1837
1838
  const [detailKey, setDetailKey] = useState2(0);
1838
1839
  const [reloadTick, setReloadTick] = useState2(0);
1840
+ const [qDraft, setQDraft] = useState2(filters.q ?? "");
1841
+ const debouncedQ = useDebouncedValue(qDraft, SEARCH_DEBOUNCE_MS);
1842
+ useEffect2(() => {
1843
+ setFilters((f) => {
1844
+ if ((f.q ?? "") === debouncedQ) return f;
1845
+ if (debouncedQ === "") {
1846
+ const { q: _drop, ...rest } = f;
1847
+ void _drop;
1848
+ return rest;
1849
+ }
1850
+ return { ...f, q: debouncedQ };
1851
+ });
1852
+ }, [debouncedQ]);
1853
+ useEffect2(() => {
1854
+ setQDraft(filters.q ?? "");
1855
+ }, [filters.q]);
1839
1856
  const activeFilterCount = useMemo(() => {
1840
1857
  return (filters.status?.length ?? 0) + (filters.type?.length ?? 0) + (filters.severity?.length ?? 0) + (filters.q ? 1 : 0) + (filters.mine ? 1 : 0);
1841
1858
  }, [filters]);
@@ -1889,6 +1906,8 @@ function BoardView({
1889
1906
  {
1890
1907
  filters,
1891
1908
  onChange: setFilters,
1909
+ searchDraft: qDraft,
1910
+ onSearchDraftChange: setQDraft,
1892
1911
  activeCount: activeFilterCount,
1893
1912
  strings,
1894
1913
  thisPage,
@@ -2015,6 +2034,8 @@ function BoardKpiStrip({
2015
2034
  function BoardFilters({
2016
2035
  filters,
2017
2036
  onChange,
2037
+ searchDraft,
2038
+ onSearchDraftChange,
2018
2039
  activeCount,
2019
2040
  strings,
2020
2041
  thisPage,
@@ -2048,7 +2069,6 @@ function BoardFilters({
2048
2069
  }
2049
2070
  };
2050
2071
  const setOrdering = (value) => onChange({ ...filters, ordering: value });
2051
- const setSearch = (q) => onChange({ ...filters, q });
2052
2072
  const toggleMine = () => {
2053
2073
  if (filters.mine) {
2054
2074
  const { mine: _drop, ...rest } = filters;
@@ -2137,8 +2157,8 @@ function BoardFilters({
2137
2157
  type: "search",
2138
2158
  class: "board-filter-search",
2139
2159
  placeholder: strings["board.filter.search.placeholder"],
2140
- value: filters.q ?? "",
2141
- onInput: (e) => setSearch(e.target.value)
2160
+ value: searchDraft,
2161
+ onInput: (e) => onSearchDraftChange(e.target.value)
2142
2162
  }
2143
2163
  ),
2144
2164
  /* @__PURE__ */ jsxs4("label", { class: "board-filter-toggle", children: [
@@ -2255,6 +2275,14 @@ function DetailEmptyIllustration() {
2255
2275
  /* @__PURE__ */ jsx3("line", { x1: "18", y1: "38", x2: "32", y2: "38", stroke: "currentColor", "stroke-opacity": "0.14", "stroke-width": "2", "stroke-linecap": "round" })
2256
2276
  ] });
2257
2277
  }
2278
+ function useDebouncedValue(value, ms) {
2279
+ const [debounced, setDebounced] = useState2(value);
2280
+ useEffect2(() => {
2281
+ const t = setTimeout(() => setDebounced(value), ms);
2282
+ return () => clearTimeout(t);
2283
+ }, [value, ms]);
2284
+ return debounced;
2285
+ }
2258
2286
  function filtersHash(f) {
2259
2287
  return JSON.stringify({
2260
2288
  s: f.status?.slice().sort(),
@@ -6175,8 +6203,8 @@ function createFeedback(config) {
6175
6203
  capture_method: captureMethod,
6176
6204
  technical_context
6177
6205
  };
6178
- if ("0.29.0") {
6179
- payload.widget_version = "0.29.0";
6206
+ if ("0.30.0") {
6207
+ payload.widget_version = "0.30.0";
6180
6208
  }
6181
6209
  if (manualScreenshots?.length) {
6182
6210
  payload.screenshots = manualScreenshots;
@@ -6302,4 +6330,4 @@ function createFeedback(config) {
6302
6330
  export {
6303
6331
  createFeedback
6304
6332
  };
6305
- //# sourceMappingURL=chunk-7FGWO6KO.mjs.map
6333
+ //# sourceMappingURL=chunk-5F36UFXG.mjs.map