Skip to content

Commit ce03dad

Browse files
committed
fixes
1 parent 7f9852b commit ce03dad

4 files changed

Lines changed: 4 additions & 140 deletions

File tree

examples/vue/row-selection/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const table = useTable(
161161
<div class="h-4" />
162162
<button @click="rerender" class="border p-2">Rerender</button>
163163
<button @click="toggleRowSelection" class="border p-2">
164-
{{ enableRowSelection ? 'Enable' : 'Disable' }} Row Selection
164+
{{ enableRowSelection ? 'Disable' : 'Enable' }} Row Selection
165165
</button>
166166
</div>
167167
</template>

packages/angular-table/src/injectTable.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,11 @@ export function injectTable<
111111
): AngularTable<TFeatures, TData, TSelected> {
112112
assertInInjectionContext(injectTable)
113113
const injector = inject(Injector)
114-
const count = 0
115114

116115
return lazyInit(() => {
117116
const stateNotifier = signal(0)
118117

119118
const angularReactivityFeature = constructReactivityFeature({
120-
// optionsNotifier: () => stateNotifier(),
121119
stateNotifier: () => {
122120
return stateNotifier()
123121
},

packages/angular-table/tests/angularReactivityFeature.test.ts

Lines changed: 2 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { describe, expect, test, vi } from 'vitest'
2-
import { computed, effect, isSignal, signal } from '@angular/core'
2+
import { computed, effect, signal } from '@angular/core'
33
import { TestBed } from '@angular/core/testing'
44
import { injectTable, stockFeatures } from '../src'
5-
import { getFnReactiveCache, testShouldBeComputedProperty } from './test-utils'
6-
import type { WritableSignal } from '@angular/core'
75
import type { ColumnDef } from '../src'
6+
import type { WritableSignal } from '@angular/core'
87

98
describe('angularReactivityFeature', () => {
109
type Data = { id: string; title: string }
@@ -42,136 +41,6 @@ describe('angularReactivityFeature', () => {
4241
}
4342

4443
const table = createTestTable()
45-
const tablePropertyKeys = Object.keys(table)
46-
47-
describe.skip('Table property reactivity', () => {
48-
test.each(
49-
tablePropertyKeys.map((property) => [
50-
property,
51-
testShouldBeComputedProperty(table, property),
52-
]),
53-
)('property (%s) is computed -> (%s)', (name, expected) => {
54-
const tableProperty = table[name as keyof typeof table]
55-
expect(isSignal(tableProperty)).toEqual(expected)
56-
})
57-
58-
describe('will create a computed for non detectable computed properties', () => {
59-
test('getIsSomeRowsPinned', () => {
60-
table.getIsSomeRowsPinned('top')
61-
table.getIsSomeRowsPinned('bottom')
62-
table.getIsSomeRowsPinned()
63-
64-
expect(getFnReactiveCache(table.getIsSomeRowsPinned)).toHaveProperty(
65-
'["top"]',
66-
)
67-
expect(getFnReactiveCache(table.getIsSomeRowsPinned)).toHaveProperty(
68-
'["bottom"]',
69-
)
70-
expect(getFnReactiveCache(table.getIsSomeRowsPinned)).toHaveProperty(
71-
'[]',
72-
)
73-
})
74-
})
75-
})
76-
77-
describe.skip('Header property reactivity', () => {
78-
const headers = table.getHeaderGroups()
79-
headers.forEach((headerGroup, index) => {
80-
const headerPropertyKeys = Object.keys(headerGroup)
81-
test.each(
82-
headerPropertyKeys.map((property) => [
83-
property,
84-
testShouldBeComputedProperty(headerGroup, property),
85-
]),
86-
)(
87-
`HeaderGroup ${headerGroup.id} (${index}) - property (%s) is computed -> (%s)`,
88-
(name, expected) => {
89-
const tableProperty = headerGroup[name as keyof typeof headerGroup]
90-
expect(isSignal(tableProperty)).toEqual(expected)
91-
},
92-
)
93-
94-
const headers = headerGroup.headers
95-
headers.forEach((header, cellIndex) => {
96-
const headerPropertyKeys = Object.keys(header).concat(
97-
Object.getOwnPropertyNames(Object.getPrototypeOf(header)),
98-
)
99-
test.each(
100-
headerPropertyKeys.map((property) => [
101-
property,
102-
testShouldBeComputedProperty(header, property),
103-
]),
104-
)(
105-
`HeaderGroup ${headerGroup.id} (${index}) / Header ${header.id} - property (%s) is computed -> (%s)`,
106-
(name, expected) => {
107-
const tableProperty = header[name as keyof typeof header]
108-
expect(isSignal(tableProperty)).toEqual(expected)
109-
},
110-
)
111-
})
112-
})
113-
})
114-
115-
describe.skip('Column property reactivity', () => {
116-
const columns = table.getAllColumns()
117-
columns.forEach((column, index) => {
118-
const columnPropertyKeys = Object.keys(column).concat(
119-
Object.getOwnPropertyNames(Object.getPrototypeOf(column)),
120-
)
121-
test.each(
122-
columnPropertyKeys.map((property) => [
123-
property,
124-
testShouldBeComputedProperty(column, property),
125-
]),
126-
)(
127-
`Column ${column.id} (${index}) - property (%s) is computed -> (%s)`,
128-
(name, expected) => {
129-
const tableProperty = column[name as keyof typeof column]
130-
expect(isSignal(tableProperty)).toEqual(expected)
131-
},
132-
)
133-
})
134-
})
135-
136-
describe.skip('Row and cells property reactivity', () => {
137-
const flatRows = table.getRowModel().flatRows
138-
flatRows.forEach((row, index) => {
139-
const rowsPropertyKeys = Object.keys(row).concat(
140-
Object.getOwnPropertyNames(Object.getPrototypeOf(row)),
141-
)
142-
test.each(
143-
rowsPropertyKeys.map((property) => [
144-
property,
145-
testShouldBeComputedProperty(row, property),
146-
]),
147-
)(
148-
`Row ${row.id} (${index}) - property (%s) is computed -> (%s)`,
149-
(name, expected) => {
150-
const tableProperty = row[name as keyof typeof row]
151-
expect(isSignal(tableProperty)).toEqual(expected)
152-
},
153-
)
154-
155-
const cells = row.getAllCells()
156-
cells.forEach((cell, cellIndex) => {
157-
const cellPropertyKeys = Object.keys(cell).concat(
158-
Object.getOwnPropertyNames(Object.getPrototypeOf(cell)),
159-
)
160-
test.each(
161-
cellPropertyKeys.map((property) => [
162-
property,
163-
testShouldBeComputedProperty(cell, property),
164-
]),
165-
)(
166-
`Row ${row.id} (${index}) / Cell ${cell.id} - property (%s) is computed -> (%s)`,
167-
(name, expected) => {
168-
const tableProperty = cell[name as keyof typeof cell]
169-
expect(isSignal(tableProperty)).toEqual(expected)
170-
},
171-
)
172-
})
173-
})
174-
})
17544

17645
describe('Integration', () => {
17746
test('methods within effect will be re-trigger when options/state changes', () => {

packages/solid-table/src/createTable.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,10 @@ export function createTable<
5858
({}) as TSelected,
5959
): SolidTable<TFeatures, TData, TSelected> {
6060
const [notifier, setNotifier] = createSignal<void>(void 0, { equals: false })
61-
const [optionsNotifier, setOptionsNotifier] = createSignal<void>(void 0, {
62-
equals: false,
63-
})
6461

6562
const solidReactivityFeature = constructReactivityFeature({
6663
stateNotifier: () => notifier(),
67-
optionsNotifier: () => optionsNotifier(),
64+
optionsNotifier: () => notifier(),
6865
})
6966

7067
const mergedOptions = mergeProps(tableOptions, {

0 commit comments

Comments
 (0)