Skip to content

Commit 5f94f09

Browse files
authored
Support __c contextRef (#493)
* Support __c contextRef * Incorporate `_id` change * Fix booboo * Try some stuff out * Run dedupe * 🤷 * Install
1 parent a767168 commit 5f94f09

File tree

4 files changed

+72
-818
lines changed

4 files changed

+72
-818
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install Deps
2121
run: yarn
2222
- name: Install Playwright
23-
run: yarn playwright install-deps chromium
23+
run: yarn playwright install --with-deps && yarn playwright install-deps chromium
2424
- name: Run tests
2525
run: |
2626
yarn lint

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"build:firefox": "node tools/build.mjs --browser firefox",
2626
"build:inline:types": "tsc -p tsconfig.inline.json",
2727
"build:inline": "node tools/build.mjs --browser inline && tsc -p tsconfig.inline.json",
28-
"archive": "git archive --form at zip --output dist/source-code.zip main",
28+
"archive": "git archive --format zip --output dist/source-code.zip main",
2929
"lint": "eslint 'src/**/*.{ts,tsx}' 'test-e2e/**/*.ts'",
3030
"test": "mochette -c tsconfig.cjs.json -r tools/test-setup.js 'src/**/*.test.{ts,tsx}'",
3131
"test:e2e": "node tools/fetch-preact-versions.mjs && playwright test",
@@ -49,7 +49,7 @@
4949
"@babel/core": "^7.18.10",
5050
"@babel/plugin-syntax-typescript": "^7.18.6",
5151
"@babel/plugin-transform-react-jsx": "^7.18.10",
52-
"@playwright/test": "^1.49.0",
52+
"@playwright/test": "^1.49.1",
5353
"@preact/preset-vite": "^2.8.2",
5454
"@preact/signals": "^1.2.3",
5555
"@prefresh/vite": "^2.4.5",
@@ -79,7 +79,6 @@
7979
"lint-staged": "^10.4.0",
8080
"mochette": "^1.0.1",
8181
"mri": "^1.2.0",
82-
"playwright-chromium": "^1.49.0",
8382
"preact": "^10.25.1",
8483
"prettier": "^3.2.5",
8584
"tar": "^6.1.11",

src/adapter/10/bindings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function getHookState(
136136
// useContext
137137
if (type === HookType.useContext) {
138138
const context = list[index]._context || list[index].__c || list[index].c;
139-
const provider = c.context[context._id] || c.context[context.__c];
139+
const provider = c.context[context._id] || c.context[context.__c] || c.context[context.__l];
140140
return provider
141141
? provider.props.value
142142
: context._defaultValue || context.__;
@@ -212,7 +212,7 @@ export function getDisplayName(vnode: VNode, config: RendererConfig): string {
212212

213213
// Provider
214214
if ((c as any).sub) {
215-
const ctx = (type as any)._contextRef || (type as any).__;
215+
const ctx = (type as any)._contextRef || (type as any).__ || (type as any).__c;
216216
if (ctx && ctx.displayName) {
217217
return `${ctx.displayName}.Provider`;
218218
}

0 commit comments

Comments
 (0)