feat: passing Dataset<T> to onion components returns result as Dataset<T>#1073
feat: passing Dataset<T> to onion components returns result as Dataset<T>#1073
Dataset<T> to onion components returns result as Dataset<T>#1073Conversation
Förhandsgranskning 🐛 🔍Dokumentation och exampel applikationer finns att förhandsgranska på: Senast uppdaterad 2026-03-06 16:30 UTC i gh-pages. |
CHANGELOGBased on commits in this Pull Request this will create a minor release and the following entries will be added to the changelog: Features
If this is not correct you can amend the commit message(s). Read more about the release process (swedish). |
Artifact sizesArtifact sizes in this build (unchanged artifacts collapsed below).
7 unchanged artifacts
|
cb8dac7 to
64f487e
Compare
…et` returns `Dataset<T>` (refs SFKUI-7348)
64f487e to
fbed2e8
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis 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)
✅ Passed checks (2 passed)
✏️ 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). Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
etc/vue.api.mdpackages/vue/src/components/FPaginateDataset/FPaginateDataset.vuepackages/vue/src/components/FSortFilterDataset/FSortFilterDataset.vuepackages/vue/src/components/FSortFilterDataset/FSortFilterFilter.tspackages/vue/src/components/FSortFilterDataset/use-sort-filter-dataset.ts
💤 Files with no reviewable changes (1)
- etc/vue.api.md
| const sortFilterResult = ref<TArray>( | ||
| [] as unknown as TArray, | ||
| ) as Ref<TArray>; |
There was a problem hiding this comment.
🧹 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.tsRepository: 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 -nRepository: 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 -nRepository: 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 -A3Repository: 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 -nRepository: 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.
FSortFilterDatasetFPaginateDatasetNotera 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.