Skip to content

feat(view-settings): workspace-level client view setting columns (OUT-3851 foundation)#1308

Open
priosshrsth wants to merge 8 commits into
mainfrom
anit/out-3851-cu-view-settings-foundation
Open

feat(view-settings): workspace-level client view setting columns (OUT-3851 foundation)#1308
priosshrsth wants to merge 8 commits into
mainfrom
anit/out-3851-cu-view-settings-foundation

Conversation

@priosshrsth

@priosshrsth priosshrsth commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Foundation PR for OUT-3851Allow IU to set view settings for CU.

Changes summary

  • Add new UI options/flow for IU to set default view settings for CU
  • Respect the default view settings override by IU when creating a new view setting for users

Test cases

Screenshot 2026-06-10 at 17 42 06 Screenshot 2026-06-10 at 17 41 43
2026-06-10.17-41-25.mov

…(foundation)

Foundation for OUT-3851. Adds nullable client view defaults to
WorkspaceSetting (value + lock per setting), widens the workspace-settings
DTO to partial updates, and exposes an IU "Client view settings" section in
configure-tasks-app. Inert on the client read path — enforcement (hard lock)
and seeding (soft default) land in follow-up PRs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

OUT-3851

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tasks-app Ready Ready Preview, Comment Jun 15, 2026 12:51pm

Request Review

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds workspace-level client view settings — default view mode and hide-subtasks toggle — that IUs can configure from the configure-tasks-app page. When a CU gets their first view-setting row created, the service now seeds it from these workspace defaults instead of the hardcoded fallbacks.

  • Schema + migration: two nullable columns (clientDefaultViewMode, clientHideSubtasks) added to WorkspaceSettings; migration is in sync and non-breaking.
  • Service layer: resolveInitialDisplayDefaults queries workspace settings for Client-role users and applies them when seeding a new ViewSetting row; IU flow is unchanged.
  • UI: new ClientViewSettingsSection component with optimistic-update + rollback; ClientViewSettings DTO type was corrected to use required-nullable fields (addressed from prior review).

Confidence Score: 4/5

Mostly safe to merge; one functional gap in the new UI means that once an IU sets a view-mode override they can never clear it back to "no preference" through the UI.

The view-mode dropdown has no "unset" option and its onChange callback never emits null, so an IU who sets List or Board is permanently stuck on that choice — they cannot return to the null/no-override state that the DB schema, placeholder text, and server logic all treat as valid. The DB column, Zod schema, and seeding logic are otherwise correct and the hide-subtasks toggle works cleanly.

src/app/configure-tasks-app/ui/ClientViewSettingsSection.tsx — the ViewModeDropdown component and its VIEW_MODE_OPTIONS array need a null/"no preference" entry.

Important Files Changed

Filename Overview
src/app/configure-tasks-app/ui/ClientViewSettingsSection.tsx New section component with optimistic update + rollback. Hide-subtasks toggle is correct; view-mode dropdown lacks a "no preference / unset" option so once set the override can never be cleared.
src/app/api/view-settings/viewSettings.service.ts Adds resolveInitialDisplayDefaults that queries workspace settings for Client users and seeds their first view-setting row accordingly; IU fallback unchanged. Logic is clean and well-commented.
src/app/api/workspace-settings/workspaceSettings.service.ts Replaced upsert with update; safe for the page UI but will throw P2025 if PATCH is ever called before a GET on the same workspace.
src/types/dto/workspaceSettings.dto.ts Adds ClientViewSettings standalone type (required nullable fields) and extends the Zod schema with clientDefaultViewMode and clientHideSubtasks. Clean fix from earlier review feedback.
prisma/schema/workspaceSetting.prisma Adds optional clientDefaultViewMode (ViewMode?) and clientHideSubtasks (Boolean?) fields; migration is in sync.
prisma/migrations/20260610074631_add_client_view_settings_to_workspace_settings/migration.sql Adds two nullable columns to WorkspaceSettings; non-breaking, matches the schema changes.
src/app/configure-tasks-app/page.tsx Wires ClientViewSettingsSection into the configure page with correct initial settings derived from the fetched workspace setting.
next.config.js Adds allowedDevOrigins wildcard for ngrok tunnels; this config key is Next.js development-only and has no effect in production.

Sequence Diagram

sequenceDiagram
    participant IU as IU Browser
    participant Page as ConfigureTasksAppPage
    participant WS_API as /api/workspace-settings
    participant WS_Svc as WorkspaceSettingsService
    participant VS_Svc as ViewSettingsService
    participant DB as Database

    IU->>Page: Load page
    Page->>WS_API: GET /api/workspace-settings
    WS_API->>WS_Svc: getWorkspaceSettings()
    WS_Svc->>DB: findUnique WorkspaceSetting
    alt Row missing
        WS_Svc->>DB: create WorkspaceSetting
    end
    WS_Svc-->>Page: "{ autoArchiveAfterDays, clientDefaultViewMode, clientHideSubtasks }"
    Page-->>IU: Render ClientViewSettingsSection

    IU->>Page: Change view mode / toggle subtasks
    Page->>WS_API: PATCH /api/workspace-settings
    WS_API->>WS_Svc: updateWorkspaceSettings(data)
    WS_Svc->>DB: update WorkspaceSetting

    Note over VS_Svc,DB: When a CU logs in for the first time
    VS_Svc->>DB: findFirst ViewSetting (none found)
    VS_Svc->>WS_Svc: resolveInitialDisplayDefaults()
    WS_Svc->>DB: findUnique WorkspaceSetting
    DB-->>WS_Svc: clientDefaultViewMode, clientHideSubtasks
    WS_Svc-->>VS_Svc: "{ viewMode, showSubtasks }"
    VS_Svc->>DB: create ViewSetting (seeded with workspace defaults)
Loading

Reviews (3): Last reviewed commit: "fix issues" | Re-trigger Greptile

Comment thread src/types/dto/workspaceSettings.dto.ts Outdated
Comment thread src/app/configure-tasks-app/ui/ClientViewSettingsSection.tsx Outdated
Use a standalone ClientViewSettings type (required locks, nullable values)
instead of Pick-ing optional DTO fields, and use an explicit null check in
handleViewModeChange for consistency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Deployment failed with the following error:

Deploying Serverless Functions to multiple regions is restricted to the Pro and Enterprise plans.

Learn More: https://vercel.link/multiple-function-regions

…ned-safety

Loose != null clears the lock for both null and undefined, guarding against a
value that is absent rather than explicitly null. Applied to both handlers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the nullable "no opinion" model and the lock columns. Foundation now
carries only the client defaults as non-nullable columns matching current
behavior (clientDefaultViewMode default board, clientHideSubtasks default
false). Lock columns, lock UI, and enforcement move to the hard-lock PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zod strips unknown keys by default; removing .strict() avoids reindenting
the autoArchiveAfterDays block and keeps the review diff additive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@priosshrsth

Copy link
Copy Markdown
Collaborator Author

@greptileai review the pr again.

@priosshrsth priosshrsth marked this pull request as draft June 10, 2026 12:07
@priosshrsth priosshrsth marked this pull request as ready for review June 12, 2026 06:50
)

* Cascade client view default to existing clients with confirmation
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.

1 participant