Skip to content

Commit

Permalink
fix: react native uSES
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianOsipiuk committed Sep 18, 2022
1 parent 08857a4 commit 0faab60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/react-query/src/useSyncExternalStore.native.ts
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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

0 comments on commit 0faab60

Please sign in to comment.