@upstash/react-redis-browser 0.1.3 → 0.1.4

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.
package/dist/index.js CHANGED
@@ -3045,14 +3045,7 @@ var PaginationCache = (_class = class {
3045
3045
  var KeysContext = _react.createContext.call(void 0, void 0);
3046
3046
  var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
3047
3047
  var KeysProvider = ({ children }) => {
3048
- const { search: searchState } = useDatabrowserStore();
3049
- const search = _react.useMemo.call(void 0,
3050
- () => ({
3051
- key: searchState.key.includes("*") ? searchState.key : `*${searchState.key}*`,
3052
- type: searchState.type
3053
- }),
3054
- [searchState]
3055
- );
3048
+ const { search } = useDatabrowserStore();
3056
3049
  const { fetchKeys, resetCache } = useFetchKeys(search);
3057
3050
  const pageRef = _react.useRef.call(void 0, 0);
3058
3051
  const query = _reactquery.useInfiniteQuery.call(void 0, {
@@ -5440,16 +5433,29 @@ var KeyItem = ({ data, nextKey }) => {
5440
5433
  // src/components/databrowser/components/sidebar/search-input.tsx
5441
5434
 
5442
5435
 
5436
+
5443
5437
  var SearchInput = () => {
5444
5438
  const { setSearchKey, search } = useDatabrowserStore();
5439
+ const [state, setState] = _react.useState.call(void 0, search.key);
5440
+ const submit = (value) => {
5441
+ if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
5442
+ setSearchKey(value);
5443
+ setState(value);
5444
+ };
5445
5445
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative grow", children: [
5446
5446
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5447
5447
  Input,
5448
5448
  {
5449
5449
  placeholder: "Search",
5450
5450
  className: "rounded-l-none border-zinc-300 font-normal",
5451
- onChange: (e) => setSearchKey(e.target.value),
5452
- value: search.key
5451
+ onKeyDown: (e) => {
5452
+ if (e.key === "Enter") submit(e.currentTarget.value);
5453
+ },
5454
+ onChange: (e) => {
5455
+ setState(e.currentTarget.value);
5456
+ if (e.currentTarget.value.trim() === "") submit("");
5457
+ },
5458
+ value: state
5453
5459
  }
5454
5460
  ),
5455
5461
  search.key && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
package/dist/index.mjs CHANGED
@@ -3045,14 +3045,7 @@ import { jsx as jsx4 } from "react/jsx-runtime";
3045
3045
  var KeysContext = createContext2(void 0);
3046
3046
  var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
3047
3047
  var KeysProvider = ({ children }) => {
3048
- const { search: searchState } = useDatabrowserStore();
3049
- const search = useMemo2(
3050
- () => ({
3051
- key: searchState.key.includes("*") ? searchState.key : `*${searchState.key}*`,
3052
- type: searchState.type
3053
- }),
3054
- [searchState]
3055
- );
3048
+ const { search } = useDatabrowserStore();
3056
3049
  const { fetchKeys, resetCache } = useFetchKeys(search);
3057
3050
  const pageRef = useRef2(0);
3058
3051
  const query = useInfiniteQuery({
@@ -5438,18 +5431,31 @@ var KeyItem = ({ data, nextKey }) => {
5438
5431
  };
5439
5432
 
5440
5433
  // src/components/databrowser/components/sidebar/search-input.tsx
5434
+ import { useState as useState10 } from "react";
5441
5435
  import { IconX } from "@tabler/icons-react";
5442
5436
  import { jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
5443
5437
  var SearchInput = () => {
5444
5438
  const { setSearchKey, search } = useDatabrowserStore();
5439
+ const [state, setState] = useState10(search.key);
5440
+ const submit = (value) => {
5441
+ if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
5442
+ setSearchKey(value);
5443
+ setState(value);
5444
+ };
5445
5445
  return /* @__PURE__ */ jsxs27("div", { className: "relative grow", children: [
5446
5446
  /* @__PURE__ */ jsx38(
5447
5447
  Input,
5448
5448
  {
5449
5449
  placeholder: "Search",
5450
5450
  className: "rounded-l-none border-zinc-300 font-normal",
5451
- onChange: (e) => setSearchKey(e.target.value),
5452
- value: search.key
5451
+ onKeyDown: (e) => {
5452
+ if (e.key === "Enter") submit(e.currentTarget.value);
5453
+ },
5454
+ onChange: (e) => {
5455
+ setState(e.currentTarget.value);
5456
+ if (e.currentTarget.value.trim() === "") submit("");
5457
+ },
5458
+ value: state
5453
5459
  }
5454
5460
  ),
5455
5461
  search.key && /* @__PURE__ */ jsxs27(
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.1.3", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.34.3", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }
1
+ { "name": "@upstash/react-redis-browser", "version": "v0.1.4", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.34.3", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }