Skip to content

Commit

Permalink
Merge branch 'master' into more-typed-wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Feb 5, 2024
2 parents f8ea8bf + e7b4727 commit 7190e32
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_script: build-only
package_manager: yarn
size_margin: non-zero
40 changes: 29 additions & 11 deletions packages/toolkit/.size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const webpack = require('webpack')
let { join } = require('path')

const esmSuffixes = ['modern.mjs', 'browser.mjs', 'legacy-esm.js']
const cjsSuffixes = ['development.cjs', 'production.min.cjs']
const esmSuffixes = ['modern.mjs' /*, 'browser.mjs', 'legacy-esm.js'*/]
const cjsSuffixes = [/*'development.cjs',*/ 'production.min.cjs']

function withRtkPath(suffix, cjs = false) {
/**
Expand Down Expand Up @@ -149,11 +149,21 @@ module.exports = entryPoints
),
)
.concat(
...[
[
{
name: `3. createSlice`,
import: { '@reduxjs/toolkit': '{ createSlice }' },
},
{
name: `3. createAsyncThunk`,
import: { '@reduxjs/toolkit': '{ createAsyncThunk }' },
},
{
name: `3. buildCreateSlice and asyncThunkCreator`,
import: {
'@reduxjs/toolkit': '{ buildCreateSlice, asyncThunkCreator }',
},
},
{
name: `3. createEntityAdapter`,
import: { '@reduxjs/toolkit': '{ createEntityAdapter }' },
Expand All @@ -162,6 +172,22 @@ module.exports = entryPoints
name: `3. configureStore`,
import: { '@reduxjs/toolkit': '{ configureStore }' },
},
{
name: `3. combineSlices`,
import: { '@reduxjs/toolkit': '{ combineSlices }' },
},
{
name: `3. createDynamicMiddleware`,
import: { '@reduxjs/toolkit': '{ createDynamicMiddleware }' },
},
{
name: `3. createDynamicMiddleware (react)`,
import: { '@reduxjs/toolkit/react': '{ createDynamicMiddleware }' },
},
{
name: `3. createListenerMiddleware`,
import: { '@reduxjs/toolkit': '{ createListenerMiddleware }' },
},
{
name: `3. createApi`,
import: { '@reduxjs/toolkit/query': '{ createApi }' },
Expand All @@ -174,14 +200,6 @@ module.exports = entryPoints
name: `3. fetchBaseQuery`,
import: { '@reduxjs/toolkit/query': '{ fetchBaseQuery }' },
},
{
name: `3. setupListeners`,
import: { '@reduxjs/toolkit/query': '{ setupListeners }' },
},
{
name: `3. ApiProvider`,
import: { '@reduxjs/toolkit/query/react': '{ ApiProvider }' },
},
].map((e) => ({
...e,
name: e.name + ` (.modern.mjs)`,
Expand Down
6 changes: 4 additions & 2 deletions packages/toolkit/src/createSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import type {
import { createAsyncThunk as _createAsyncThunk } from './createAsyncThunk'
import { emplace } from './utils'

const asyncThunkSymbol = Symbol.for('rtk-slice-createasyncthunk')
const asyncThunkSymbol = /* @__PURE__ */ Symbol.for(
'rtk-slice-createasyncthunk',
)
// type is annotated because it's too long to infer
export const asyncThunkCreator: {
[asyncThunkSymbol]: typeof _createAsyncThunk
Expand Down Expand Up @@ -863,7 +865,7 @@ function wrapSelector<State, NewState, S extends Selector<State>>(
*
* @public
*/
export const createSlice = buildCreateSlice()
export const createSlice = /* @__PURE__ */ buildCreateSlice()

interface ReducerHandlingContext<State> {
sliceCaseReducersByName: Record<
Expand Down

0 comments on commit 7190e32

Please sign in to comment.