Skip to content

fix: update combobox props in SpaceSelect component - #1564

Merged
Philipinho merged 1 commit into
docmost:mainfrom
Pleasurecruise:fix-select
Sep 17, 2025
Merged

Philipinho merged 1 commit into
docmost:mainfrom
Pleasurecruise:fix-select

Conversation

@Pleasurecruise

@Pleasurecruise Pleasurecruise commented Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

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

    • Space selector dropdown now fully closes (unmounts) when dismissed, improving responsiveness and preventing lingering UI elements.
  • Style

    • Removed dropdown padding for a tighter, more aligned appearance in the sidebar.

Added 'keepMounted: false' and 'dropdownPadding: 0' to comboboxProps for improved dropdown behavior and appearance in the SpaceSelect sidebar component.
@coderabbitai

coderabbitai Bot commented Sep 16, 2025 •

Copy link
Copy Markdown

Walkthrough

Combobox 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

Cohort / File(s) Summary of changes
Space select dropdown behavior
apps/client/src/features/space/components/sidebar/space-select.tsx
Updated Select comboboxProps: added keepMounted: false and dropdownPadding: 0; preserved width, withinPortal: true, position: "bottom". No other logic changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I nudge the dropdown, light as air,
Unmount when closed—no padding there.
Scrolls no longer make it twitch,
A bunny fixes one small glitch.
With portals true and bottom bound,
The space selector’s smooth and sound. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix: update combobox props in SpaceSelect component" concisely and accurately summarizes the primary change — updating combobox props on the SpaceSelect component — and matches the file-level change in apps/client/src/features/space/components/sidebar/space-select.tsx; it is a single clear sentence and follows conventional commit style so a reviewer can quickly understand the main intent.
Linked Issues Check ✅ Passed The PR explicitly references Fix #1531 and changes the SpaceSelect component to add comboboxProps { keepMounted: false, dropdownPadding: 0 }, which directly targets the scrolling/visual glitch described in issue #1531 by unmounting the dropdown when closed and removing extra dropdown padding that could affect positioning; therefore the code change aligns with the linked issue's primary objective.
Out of Scope Changes Check ✅ Passed The diff is limited to comboboxProps in apps/client/src/features/space/components/sidebar/space-select.tsx with no other files or unrelated logic changed, so there are no apparent out-of-scope modifications.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) yields slug === null, so find(...) returns undefined and is forwarded to onChange(ISpace).
  • If spaces is momentarily undefined, spaces.items?.find dereferences spaces.items and can throw.

Fix by null‑guarding and forwarding null for 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.

Select emits string | null on clear; this wrapper should accept ISpace | 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 any in the onChange handler.


54-72: Rebuild options deterministically; remove stale state/optional‑chain pitfall.

  • spaces?.items followed by .filter(...) will throw if items is undefined.
  • Using data inside 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

📥 Commits

Reviewing files that changed from the base of the PR and between 04ae1d7 and 0f592d9.

📒 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 supports keepMounted and dropdownPadding via comboboxProps.

Select/TagsInput docs show comboboxProps={{ dropdownPadding: ... }} examples, and overlay primitives (Popover/Transition) expose keepMounted, so both keys can be passed through comboboxProps.

@Philipinho
Philipinho merged commit fe6ecdf into docmost:main Sep 17, 2025
@Philipinho

Copy link
Copy Markdown
Member

Thanks for your contribution.

@Pleasurecruise
Pleasurecruise deleted the fix-select branch September 17, 2025 14:16
github-actions Bot added a commit to antiagingrecord/docmost that referenced this pull request Oct 9, 2025
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
nulluserid pushed a commit to N2con-Inc/docmost that referenced this pull request Dec 17, 2025
Added 'keepMounted: false' and 'dropdownPadding: 0' to comboboxProps for improved dropdown behavior and appearance in the SpaceSelect sidebar component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Space selection, visual glitch when scrolling

2 participants