Skip to content

Commit e581bf3

Browse files
fix: peer deps and async computed (#988)
* peer deps are more variable * remove async computed in preparation for v2 * changeset
1 parent 0254c4f commit e581bf3

File tree

7 files changed

+10153
-8364
lines changed

7 files changed

+10153
-8364
lines changed

.changeset/cuddly-readers-invent.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@qwik-ui/headless': patch
3+
---
4+
5+
fix: packages now have a variable range of peer dependencies
6+
7+
fix: async computed signals are now sync in preparation for v2

packages/kit-headless/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"private": false,
3232
"peerDependencies": {
33-
"@builder.io/qwik": "^1.9"
33+
"@builder.io/qwik": ">=1.9"
3434
},
3535
"dependencies": {
3636
"@floating-ui/core": "^1.6.2",

packages/kit-headless/src/components/combobox/combobox-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const HComboboxInput = component$(
3636
getActiveDescendant$,
3737
} = useCombobox();
3838

39-
const activeDescendantSig = useComputed$(async () => {
39+
const activeDescendantSig = useComputed$(() => {
4040
if (context.isListboxOpenSig.value) {
4141
return getActiveDescendant$(context.highlightedIndexSig.value ?? -1);
4242
} else {

packages/kit-headless/src/components/select/select-display-value.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const HSelectDisplayValue = component$((props: SelectValueProps) => {
2020
const context = useContext(SelectContextId);
2121
const valueId = `${context.localId}-value`;
2222

23-
const displayStrSig = useComputed$(async () => {
23+
const displayStrSig = useComputed$(() => {
2424
if (context.multiple) {
2525
// for more customization when multiple is true
2626
return <Slot />;

packages/kit-headless/src/hooks/combined-refs.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Signal, useSignal, useTask$, $, useComputed$ } from '@builder.io/qwik';
1+
import { Signal, useSignal, useTask$, useComputed$ } from '@builder.io/qwik';
22

33
/* This hook merges a consumer passed ref with our internal ref. It allows consumers to pass a reference to the component and get access to the underlying element. */
44

@@ -13,26 +13,18 @@ export function useCombinedRef(externalRef: any, ctxOpts?: CtxOpts) {
1313
// we create a ref in case the consumer does not pass a ref
1414
const internalRef = useSignal<HTMLElement>();
1515

16-
/** Grab the key name so it updates context Ex: context.triggerRef => triggerRef */
17-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
18-
const getContextKey = $((context: any, ref: Signal): string | undefined => {
19-
for (const key in context) {
20-
if (context[key] === ref) {
16+
// we get the ref from the context if it exists
17+
const ctxRefNameSig = useComputed$(() => {
18+
if (!ctxOpts?.context || !ctxOpts?.givenContextRef) return;
19+
20+
for (const key in ctxOpts.context) {
21+
if (ctxOpts.context[key] === ctxOpts.givenContextRef) {
2122
return key;
2223
}
2324
}
2425
return undefined;
2526
});
2627

27-
// we get the ref from the context if it exists
28-
const ctxRefNameSig = useComputed$(async () => {
29-
if (!ctxOpts?.context) return;
30-
31-
return (
32-
ctxOpts?.givenContextRef &&
33-
(await getContextKey(ctxOpts.context, ctxOpts.givenContextRef))
34-
);
35-
});
3628
const contextRefExists = ctxRefNameSig.value !== undefined;
3729
const contextRef = contextRefExists && ctxOpts?.context?.[ctxRefNameSig.value!];
3830

packages/kit-styled/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"private": false,
2121
"scripts": {},
2222
"peerDependencies": {
23-
"@builder.io/qwik": "^1.9"
23+
"@builder.io/qwik": ">=1.9"
2424
},
2525
"devDependencies": {
2626
"@qwik-ui/headless": "^0.6.0",

pnpm-lock.yaml

Lines changed: 10135 additions & 8345 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)