Skip to content

feat: passing Dataset<T> to onion components returns result as Dataset<T>#1073

Merged
ext merged 1 commit intomainfrom
feature/onion-dataset
Mar 6, 2026
Merged

feat: passing Dataset<T> to onion components returns result as Dataset<T>#1073
ext merged 1 commit intomainfrom
feature/onion-dataset

Conversation

@ext
Copy link
Contributor

@ext ext commented Mar 6, 2026

  • FSortFilterDataset
  • FPaginateDataset

Notera att det fortfarande inte ligger någon faktiskt metadata där, det här är bara för att behålla typningen hela vägen ner till FTable.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Förhandsgranskning 🐛 🔍

Dokumentation och exampel applikationer finns att förhandsgranska på:

Sida URL
Dokumentation https://Forsakringskassan.github.io/designsystem/pr-preview/pr-1073/
Vue Sandbox https://Forsakringskassan.github.io/designsystem/pr-preview/pr-1073/vue-sandbox
Applikationsmall https://Forsakringskassan.github.io/designsystem/pr-preview/pr-1073/examples/page-layout

Senast uppdaterad 2026-03-06 16:30 UTC i gh-pages.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

CHANGELOG

Based on commits in this Pull Request this will create a minor release and the following entries will be added to the changelog:


Features

  • passing `Dataset<T>` to `FSortFilterDataset` or `FPaginateDataset` returns `Dataset<T>` (refs SFKUI-7348) fbed2e8

If this is not correct you can amend the commit message(s).

Read more about the release process (swedish).

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Artifact sizes

Artifact sizes in this build (unchanged artifacts collapsed below).

Artifact Files Size Change
@fkui/vue (esm) 1 file(s) 1.0MiB → 1.0MiB (-63B) -0.01%
7 unchanged artifacts
Artifact Files Size
@fkui/date (esm) 1 file(s) 32.2KiB
@fkui/design 2 file(s) 187.8KiB
@fkui/logic (esm) 1 file(s) 161.8KiB
@fkui/vue (FBadge bundle) 1 file(s) 546.7KiB
@fkui/vue/cypress 1 file(s) 55.8KiB
@fkui/vue/selectors 1 file(s) 3.3KiB
@fkui/vue-labs (esm) 1 file(s) 248.2KiB

@ext ext force-pushed the feature/onion-dataset branch from cb8dac7 to 64f487e Compare March 6, 2026 16:18
…et` returns `Dataset<T>` (refs SFKUI-7348)
@ext ext force-pushed the feature/onion-dataset branch from 64f487e to fbed2e8 Compare March 6, 2026 16:26
@ext
Copy link
Contributor Author

ext commented Mar 6, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Walkthrough

This PR extends Vue component and utility function signatures across the library to support both Dataset-wrapped and plain array data structures. Changes include introducing generic TArray parameters constrained to Dataset | T[], adding a TInfered conditional type alias to normalize both data structure types, and updating prop interfaces, return types, and function signatures accordingly. The filter and sort-filter utilities are generalized to preserve input type through operations. An import of UnwrapRefSimple is removed from the public API report.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: implementing type-preserving behavior for onion components to return Dataset when passed Dataset.
Description check ✅ Passed The description is related to the changeset, mentioning the two affected components (FSortFilterDataset and FPaginateDataset) and noting that metadata typing is preserved.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts`:
- Around line 129-131: The initialization of sortFilterResult uses a
non-idiomatic cast ([] as unknown as TArray); replace that with toValue(data) so
sortFilterResult is initialized with the correct typed value immediately. Update
the const sortFilterResult = ref<TArray>(...) declaration to use toValue(data)
(referencing sortFilterResult, toValue, and data) so the immediate watcher no
longer depends on an overwritten placeholder value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3991c963-b7a5-4cba-8838-7f5fa05dcf96

📥 Commits

Reviewing files that changed from the base of the PR and between aead241 and fbed2e8.

📒 Files selected for processing (5)
  • etc/vue.api.md
  • packages/vue/src/components/FPaginateDataset/FPaginateDataset.vue
  • packages/vue/src/components/FSortFilterDataset/FSortFilterDataset.vue
  • packages/vue/src/components/FSortFilterDataset/FSortFilterFilter.ts
  • packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts
💤 Files with no reviewable changes (1)
  • etc/vue.api.md

Comment on lines +129 to +131
const sortFilterResult = ref<TArray>(
[] as unknown as TArray,
) as Ref<TArray>;
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the file to examine lines 129-131 and surrounding context
echo "=== File contents around lines 129-131 ==="
wc -l packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts

Repository: Forsakringskassan/designsystem

Length of output: 194


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Get context around lines 129-131
sed -n '115,145p' packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts | cat -n

Repository: Forsakringskassan/designsystem

Length of output: 1379


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check imports and overall structure
head -60 packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts | cat -n

Repository: Forsakringskassan/designsystem

Length of output: 1985


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for watcher implementations that update sortFilterResult
rg -n 'sortFilterResult|watch\(|watchEffect' packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts -A3

Repository: Forsakringskassan/designsystem

Length of output: 1403


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check the full function to see if sortFilterResult is read before return
sed -n '100,239p' packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts | cat -n

Repository: Forsakringskassan/designsystem

Length of output: 5215


Replace [] as unknown as TArray initialization with toValue(data) to eliminate non-idiomatic type casting.

The initial empty array is immediately overwritten by the immediate: true watcher during setup, making the double-cast unnecessary. Using toValue(data) provides the correct type without intermediate casting.

♻️ Proposed refactor
-    const sortFilterResult = ref<TArray>(
-        [] as unknown as TArray,
-    ) as Ref<TArray>;
+    const sortFilterResult = ref<TArray>(
+        toValue(data),
+    ) as Ref<TArray>;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts`
around lines 129 - 131, The initialization of sortFilterResult uses a
non-idiomatic cast ([] as unknown as TArray); replace that with toValue(data) so
sortFilterResult is initialized with the correct typed value immediately. Update
the const sortFilterResult = ref<TArray>(...) declaration to use toValue(data)
(referencing sortFilterResult, toValue, and data) so the immediate watcher no
longer depends on an overwritten placeholder value.

@ext ext merged commit 1ae187a into main Mar 6, 2026
28 checks passed
@ext ext deleted the feature/onion-dataset branch March 6, 2026 18:51
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.

2 participants