Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: react native uSES #4185

Merged
merged 1 commit into from Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/react-query/src/useSyncExternalStore.native.ts
@@ -1,3 +1,5 @@
// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601
// @ts-ignore
export { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js'
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.native.js'

export { useSyncExternalStore }
4 changes: 3 additions & 1 deletion packages/react-query/src/useSyncExternalStore.ts
@@ -1,2 +1,4 @@
// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601
export { useSyncExternalStore } from 'use-sync-external-store/shim/index.js'
import { useSyncExternalStore as uSES } from 'use-sync-external-store/shim/index.js'

export const useSyncExternalStore = uSES
4 changes: 3 additions & 1 deletion rollup.config.ts
Expand Up @@ -80,12 +80,13 @@ export default function rollup(options: RollupOptions): RollupOptions[] {
packageDir: 'packages/react-query',
jsName: 'ReactQuery',
outputFile: 'index',
entryFile: ['src/index.ts', 'src/reactBatchedUpdates.native.ts'],
entryFile: ['src/index.ts', 'src/reactBatchedUpdates.native.ts', 'src/useSyncExternalStore.native.ts'],
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'@tanstack/query-core': 'QueryCore',
'use-sync-external-store/shim/index.js': 'UseSyncExternalStore',
'use-sync-external-store/shim/index.native.js': 'UseSyncExternalStoreNative',
'react-native': 'ReactNative',
},
bundleUMDGlobals: [
Expand Down Expand Up @@ -321,6 +322,7 @@ function cjs({
// TODO: figure out a better way to produce extensionless cjs imports
"require('./logger.js')": "require('./logger')",
"require('./reactBatchedUpdates.js')": "require('./reactBatchedUpdates')",
"require('./useSyncExternalStore.js')": "require('./useSyncExternalStore')",
preventAssignment: true,
delimiters: ['', ''],
}),
Expand Down