@mhosaic/feedback 0.29.0 → 0.31.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]);
@@ -1849,6 +1866,8 @@ function BoardView({
1849
1866
  }, [filtersHash(filters), thisPage, reloadTick]);
1850
1867
  useEffect2(() => {
1851
1868
  let cancelled = false;
1869
+ setPage(null);
1870
+ setKpis(null);
1852
1871
  setLoading(true);
1853
1872
  const poll = startPoll(async () => {
1854
1873
  try {
@@ -1889,6 +1908,8 @@ function BoardView({
1889
1908
  {
1890
1909
  filters,
1891
1910
  onChange: setFilters,
1911
+ searchDraft: qDraft,
1912
+ onSearchDraftChange: setQDraft,
1892
1913
  activeCount: activeFilterCount,
1893
1914
  strings,
1894
1915
  thisPage,
@@ -2015,6 +2036,8 @@ function BoardKpiStrip({
2015
2036
  function BoardFilters({
2016
2037
  filters,
2017
2038
  onChange,
2039
+ searchDraft,
2040
+ onSearchDraftChange,
2018
2041
  activeCount,
2019
2042
  strings,
2020
2043
  thisPage,
@@ -2048,7 +2071,6 @@ function BoardFilters({
2048
2071
  }
2049
2072
  };
2050
2073
  const setOrdering = (value) => onChange({ ...filters, ordering: value });
2051
- const setSearch = (q) => onChange({ ...filters, q });
2052
2074
  const toggleMine = () => {
2053
2075
  if (filters.mine) {
2054
2076
  const { mine: _drop, ...rest } = filters;
@@ -2137,8 +2159,8 @@ function BoardFilters({
2137
2159
  type: "search",
2138
2160
  class: "board-filter-search",
2139
2161
  placeholder: strings["board.filter.search.placeholder"],
2140
- value: filters.q ?? "",
2141
- onInput: (e) => setSearch(e.target.value)
2162
+ value: searchDraft,
2163
+ onInput: (e) => onSearchDraftChange(e.target.value)
2142
2164
  }
2143
2165
  ),
2144
2166
  /* @__PURE__ */ jsxs4("label", { class: "board-filter-toggle", children: [
@@ -2255,6 +2277,14 @@ function DetailEmptyIllustration() {
2255
2277
  /* @__PURE__ */ jsx3("line", { x1: "18", y1: "38", x2: "32", y2: "38", stroke: "currentColor", "stroke-opacity": "0.14", "stroke-width": "2", "stroke-linecap": "round" })
2256
2278
  ] });
2257
2279
  }
2280
+ function useDebouncedValue(value, ms) {
2281
+ const [debounced, setDebounced] = useState2(value);
2282
+ useEffect2(() => {
2283
+ const t = setTimeout(() => setDebounced(value), ms);
2284
+ return () => clearTimeout(t);
2285
+ }, [value, ms]);
2286
+ return debounced;
2287
+ }
2258
2288
  function filtersHash(f) {
2259
2289
  return JSON.stringify({
2260
2290
  s: f.status?.slice().sort(),
@@ -6175,8 +6205,8 @@ function createFeedback(config) {
6175
6205
  capture_method: captureMethod,
6176
6206
  technical_context
6177
6207
  };
6178
- if ("0.29.0") {
6179
- payload.widget_version = "0.29.0";
6208
+ if ("0.31.0") {
6209
+ payload.widget_version = "0.31.0";
6180
6210
  }
6181
6211
  if (manualScreenshots?.length) {
6182
6212
  payload.screenshots = manualScreenshots;
@@ -6302,4 +6332,4 @@ function createFeedback(config) {
6302
6332
  export {
6303
6333
  createFeedback
6304
6334
  };
6305
- //# sourceMappingURL=chunk-7FGWO6KO.mjs.map
6335
+ //# sourceMappingURL=chunk-AA24TFKX.mjs.map