Repository navigation
fix: update combobox props in SpaceSelect component - #1564
Conversation
Added 'keepMounted: false' and 'dropdownPadding: 0' to comboboxProps for improved dropdown behavior and appearance in the SpaceSelect sidebar component.
WalkthroughCombobox properties in SpaceSelect were adjusted: keepMounted set to false, dropdownPadding to 0, while retaining width, withinPortal: true, and position: "bottom". This modifies dropdown mounting and padding behavior. No other logic or exported API changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/client/src/features/space/components/sidebar/space-select.tsx (1)
86-88: onChange can pass undefined and can throw when spaces is undefined.
- Clearing selection (
clearable) yieldsslug === null, sofind(...)returnsundefinedand is forwarded toonChange(ISpace).- If
spacesis momentarily undefined,spaces.items?.finddereferencesspaces.itemsand can throw.Fix by null‑guarding and forwarding
nullfor clears:- onChange={(slug) => - onChange(spaces.items?.find((item) => item.slug === slug)) - } + onChange={(slug) => { + const selected = + slug ? spaces?.items?.find((i) => i.slug === slug) ?? null : null; + onChange(selected as any); // remove `as any` after updating prop type below + }}
🧹 Nitpick comments (3)
apps/client/src/features/space/components/sidebar/space-select.tsx (3)
10-17: Align prop type with clearable Select: allow null.
Selectemitsstring | nullon clear; this wrapper should acceptISpace | null.interface SpaceSelectProps { - onChange: (value: ISpace) => void; + onChange: (value: ISpace | null) => void; value?: string; label?: string; width?: number; opened?: boolean; clearable?: boolean; }After this, remove the temporary
as anyin the onChange handler.
54-72: Rebuild options deterministically; remove stale state/optional‑chain pitfall.
spaces?.itemsfollowed by.filter(...)will throw ifitemsis undefined.- Using
datainside the effect while not listing it in deps risks stale filtering and duplicate accumulation.- Accumulating across queries inflates the list unnecessarily; just use current
spaces.Refactor:
- useEffect(() => { - if (spaces) { - const spaceData = spaces?.items - .filter((space: ISpace) => space.slug !== value) - .map((space: ISpace) => { - return { - label: space.name, - value: space.slug, - icon: space.logo, - }; - }); - - const filteredSpaceData = spaceData.filter( - (space) => - !data.find((existingSpace) => existingSpace.value === space.value), - ); - setData((prevData) => [...prevData, ...filteredSpaceData]); - } - }, [spaces]); + useEffect(() => { + if (!spaces) { + setData([]); + return; + } + const items = spaces.items ?? []; + const next = items + .filter((space: ISpace) => space.slug !== value) + .map((space: ISpace) => ({ + label: space.name, + value: space.slug, + icon: space.logo, + })); + setData(next); + }, [spaces, value]);
52-53: Type the local options array.Avoid
never[]inference and improve editor help.- const [data, setData] = useState([]); + type SpaceOption = { label: string; value: string; icon?: string | null }; + const [data, setData] = useState<SpaceOption[]>([]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/client/src/features/space/components/sidebar/space-select.tsx(1 hunks)
🔇 Additional comments (1)
apps/client/src/features/space/components/sidebar/space-select.tsx (1)
93-93: Combobox props change approved — Mantine supportskeepMountedanddropdownPaddingviacomboboxProps.Select/TagsInput docs show
comboboxProps={{ dropdownPadding: ... }}examples, and overlay primitives (Popover/Transition) exposekeepMounted, so both keys can be passed throughcomboboxProps.
|
Thanks for your contribution. |
4231ba9 Merge commit '042836cb6d7cc1f71af3ce44c7957f8abbbf8f25' into feat/aar_edition 042836c sync 4f1f0ba fix 3164b69 feat: api keys management (EE) (docmost#1665) 16c1e86 fix comment space c9b1cad sync bf8cf62 feat: Typesense search driver (EE) (docmost#1664) 5a2e16a Merge commit '31350303760163384113bf49d07127e886f94907' into feat/aar_edition 3bc710d Adds CLAUDE.md documentation 16914f1 Block search for non-indexed shares ca75e29 Set default page mode to Read 3135030 fix editor converter (docmost#1647) 3fae41a fix: editor performance improvements (docmost#1648) b50e256 sync 1f3b0c7 cloud fix 3c4cab0 v0.23.2 4de25a8 invalidate queries on space deletion cf5bbb1 fix import html processing ac17521 sync 9ac180f fix: enhance page import (docmost#1570) 46669fe (cloud) disable page sharing in trial mode fe6ecdf fix: update combobox props in SpaceSelect component (docmost#1564) 04ae1d7 Allow lastColumnResizable in table 1280f96 feat: implement space and workspace icons (docmost#1558) 61d1cf8 fix: reset file inputs after import f413720 - sync - reinstantiate S3 client to fix file upload errors during import - delete import zip file after use 8e16ad9 v0.23.1 7ada3cb fix: page import task (docmost#1551) 47c5417 sync dc06502 sync 091e790 fix attachment search in cloud ae24ea2 v0.23.0 9df6061 lock file 31053e2 update mermaid eb8e850 use debug c99bfb8 make print better 26ea04e sync 6cc58c5 sync 7d2ff34 UI fixes b08d37f fix d43ee77 remove debug log 5d91eb4 feat: queue imported attachments for indexing 3e9f6b1 Remove version from docker-compose.yml [deprecated] (docmost#1011) db55de9 feat: progressive web app (docmost#614) 1919eba New Crowdin updates (docmost#1522) 7951b2e New Crowdin updates (docmost#1509) 73b78f6 more translations cf7534d fix version display adec36d fix: adjust margins - use default browser highlight background f9e1080 sync 00e499b Fixing extra page bug on print (docmost#1478) 5ee6e46 checkbox aligned to text (docmost#1486) 1f797c3 fix: confluence drawio import (docmost#1518) f12866c feat(EE): full-text search in attachments (docmost#1502) dcbb65d feat(EE): LDAP integration (docmost#1515) 5968764 feat: emoji callout icon (docmost#1323) 242fb6b fix: set mermaid theme based on computed color scheme (docmost#1438) 74cd890 feat(EE): implement SSO group sync for SAML and OIDC (docmost#1452) 509622a ignore type error 937386e fix: hide table handles in readonly mode 60a373f fix: readonly editor table responsiveness 73ee6ee feat: subpages (child pages) list node (docmost#1462) 7d1e5bc feat: table row/column drag and drop (docmost#1467) aa58e27 fix: exclude deleted pages (docmost#1494) 08135a2 sync d92a942 sync 5012a68 sync 5a33777 feat: debug mode env variable (docmost#1450) 3b85f4b fix: enforce C collation for page position ordering to ensure consistent behavior in Postgres 17+ (docmost#1446) cb2a039 fix: invalidate trashed page from tree state 95b7be6 fix: hide trash from can view permission (docmost#1445) b0c5572 fix nested taskList in markdown export (docmost#1443) dddfd48 feat: add attachments support for single page exports (docmost#1440) aa6eec7 fix: exclude trashed pages from position generation 97a7701 fix local storage copy function (docmost#1442) b97eb85 sync git-subtree-dir: vendor/app git-subtree-split: 4231ba9
Added 'keepMounted: false' and 'dropdownPadding: 0' to comboboxProps for improved dropdown behavior and appearance in the SpaceSelect sidebar component.
Fix #1531
Added 'keepMounted: false' and 'dropdownPadding: 0' to comboboxProps for improved dropdown behavior and appearance in the SpaceSelect sidebar component.
Summary by CodeRabbit
Bug Fixes
Style