Skip to content

Commit 0d9b0e1

Browse files
authored
Merge pull request #2070 from reduxjs/bugfix/2063-uses-imports
2 parents 34d1653 + 5f3d30c commit 0d9b0e1

File tree

4 files changed

+151
-966
lines changed

4 files changed

+151
-966
lines changed

.github/workflows/test.yml

+74
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,80 @@ jobs:
9797
- name: Run are-the-types-wrong
9898
run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-cjs no-resolution
9999

100+
test-published-artifact:
101+
name: Test Published Artifact ${{ matrix.example }}
102+
103+
needs: [build]
104+
runs-on: ubuntu-latest
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
node: ['16.x']
109+
example: ['cra4', 'cra5', 'next', 'vite', 'node-standard', 'node-esm']
110+
steps:
111+
- name: Checkout repo
112+
uses: actions/checkout@v4
113+
114+
- name: Use node ${{ matrix.node }}
115+
uses: actions/setup-node@v3.8.1
116+
with:
117+
node-version: ${{ matrix.node }}
118+
cache: 'yarn'
119+
120+
- name: Clone RTK repo
121+
run: git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit
122+
123+
- name: Check out v2.0-integration
124+
working-directory: ./redux-toolkit
125+
run: git checkout v2.0-integration
126+
127+
- name: Check folder contents
128+
run: ls -l .
129+
130+
# Some weird install diffs with cloning this repo and installing.
131+
# Just kill the lockfiles for React-Redux and RTK and reinstall
132+
133+
- name: Remove React-Redux lockfile
134+
run: rm yarn.lock && rm package.json
135+
136+
- name: Remove RTK lockfile
137+
working-directory: ./redux-toolkit
138+
run: rm yarn.lock && rm package.json
139+
140+
- name: Install deps
141+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
142+
run: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn add msw@latest
143+
144+
- name: Install Playwright browser if necessary
145+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
146+
continue-on-error: true
147+
run: yarn playwright install
148+
149+
- uses: actions/download-artifact@v2
150+
with:
151+
name: package
152+
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
153+
154+
- name: Check folder contents
155+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
156+
run: ls -l .
157+
158+
- name: Install build artifact
159+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
160+
run: yarn add ./package.tgz
161+
162+
- name: Show installed package versions
163+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
164+
run: yarn info react-redux && yarn why react-redux
165+
166+
- name: Build example
167+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
168+
run: yarn build
169+
170+
- name: Run test step
171+
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
172+
run: yarn test
173+
100174
test-published-artifact-local:
101175
name: Test Published Artifact (Local) ${{ matrix.example }}
102176

src/alternate-renderers.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
'use client'
2-
31
// The "alternate renderers" entry point is primarily here to fall back on a no-op
42
// version of `unstable_batchedUpdates`, for use with renderers other than ReactDOM/RN.
53
// Examples include React-Three-Fiber, Ink, etc.
64
// We'll assume they're built with React 18 and thus have `useSyncExternalStore` available.
75

86
import * as React from 'react'
9-
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
7+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js'
108

119
import { initializeUseSelector } from './hooks/useSelector'
1210
import { initializeConnect } from './components/connect'

src/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
'use client'
2-
31
// The primary entry point assumes we are working with React 18, and thus have
42
// useSyncExternalStore available. We can import that directly from React itself.
53
// The useSyncExternalStoreWithSelector has to be imported, but we can use the
64
// non-shim version. This shaves off the byte size of the shim.
75

86
import * as React from 'react'
9-
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
7+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js'
108

119
import { unstable_batchedUpdates as batchInternal } from './utils/reactBatchedUpdates'
1210
import { setBatch } from './utils/batch'

0 commit comments

Comments
 (0)