Skip to content

Commit

Permalink
remove slice export from main and move to patch
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Oct 6, 2022
1 parent 32765cf commit 56f8069
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/gatsby/cache-dir/gatsby-browser-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ export {

export { graphql, prefetchPathname }
export { StaticQuery, StaticQueryContext, useStaticQuery } from "./static-query"
export { Slice } from "./slice"
export * from "gatsby-script"
1 change: 0 additions & 1 deletion packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ module.exports = async (
})
),
"global.hasPartialHydration": isPartialHydrationEnabled,
"_CFLAGS_.GATSBY_MAJOR": JSON.stringify(_CFLAGS_.GATSBY_MAJOR),
}),

plugins.virtualModules(),
Expand Down
2 changes: 1 addition & 1 deletion patches/v5/3-remove-static-query-component.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ index c2bfd3e2b7..9e0f1205bf 100644
export { graphql, prefetchPathname }
-export { StaticQuery, StaticQueryContext, useStaticQuery } from "./static-query"
+export { StaticQueryContext, useStaticQuery } from "./static-query"
export { Slice } from "./slice"
export * from "gatsby-script"
diff --git a/packages/gatsby/cache-dir/static-query.js b/packages/gatsby/cache-dir/static-query.js
index e31cebb08a..cef8ab70ed 100644
--- a/packages/gatsby/cache-dir/static-query.js
Expand Down
29 changes: 20 additions & 9 deletions patches/v5/5-slices-api.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
diff --git a/packages/gatsby/cache-dir/gatsby-browser-entry.js b/packages/gatsby/cache-dir/gatsby-browser-entry.js
index 9e0f1205bf..f0a7dcb841 100644
--- a/packages/gatsby/cache-dir/gatsby-browser-entry.js
+++ b/packages/gatsby/cache-dir/gatsby-browser-entry.js
@@ -23,4 +23,5 @@ export {

export { graphql, prefetchPathname }
export { StaticQueryContext, useStaticQuery } from "./static-query"
+export { Slice } from "./slice"
export * from "gatsby-script"
diff --git a/packages/gatsby/index.d.ts b/packages/gatsby/index.d.ts
index 57c92929c1..10763ffa32 100644
index db2b6a78c1..f0e7745e01 100644
--- a/packages/gatsby/index.d.ts
+++ b/packages/gatsby/index.d.ts
@@ -182,6 +182,30 @@ export type HeadFC<DataType = object, PageContextType = object> = (
Expand Down Expand Up @@ -33,7 +43,7 @@ index 57c92929c1..10763ffa32 100644
/**
* Props object passed into the [getServerData](https://www.gatsbyjs.com/docs/reference/rendering-options/server-side-rendering/) function.
*/
@@ -1227,6 +1251,14 @@ export interface Actions {
@@ -1207,6 +1231,14 @@ export interface Actions {
option?: ActionOptions
): void

Expand All @@ -48,19 +58,20 @@ index 57c92929c1..10763ffa32 100644
/** @see https://www.gatsbyjs.com/docs/actions/#deleteNode */
deleteNode(node: NodeInput, plugin?: ActionPlugin): void

@@ -1664,6 +1696,12 @@ export interface Page<TContext = Record<string, unknown>> {
@@ -1642,6 +1674,13 @@ export interface Page<TContext = Record<string, unknown>> {
context?: TContext
ownerNodeId?: string
defer?: boolean
}

+ slices?: Record<string, string>
+}
+
+export interface SliceInput<TContext = Record<string, unknown>> {
+ id: string
+ component: string
+ context?: TContext
+}
+
}
export interface IPluginRefObject {
resolve: string
options?: IPluginRefOptions
diff --git a/packages/gatsby/src/redux/actions/restricted.ts b/packages/gatsby/src/redux/actions/restricted.ts
index cb105dfa6d..0ee5d3eda7 100644
--- a/packages/gatsby/src/redux/actions/restricted.ts
Expand Down

0 comments on commit 56f8069

Please sign in to comment.