[Snyk] Upgrade next-sanity from 0.6.12 to 0.8.2 #641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to upgrade next-sanity from 0.6.12 to 0.8.2.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Release notes
Package name: next-sanity
0.8.2 (2022-08-20)
Bug Fixes
This release is also available on:
0.8.1 (2022-08-17)
Bug Fixes
@ sanity/semantic-release-preset
(8dec077)This release is also available on:
0.8.0 (2022-08-16)
Features
<noscript>
to NextStudio (b251176)0.8.0-new-preview-mode.3 (2022-08-12)
Bug Fixes
0.8.0-new-preview-mode.2 (2022-08-12)
Bug Fixes
0.8.0-new-preview-mode.1 (2022-08-12)
Bug Fixes
Features
0.7.1-new-preview-mode.2 (2022-08-12)
Bug Fixes
0.7.1-new-preview-mode.1 (2022-08-12)
Bug Fixes
0.7.0 (2022-08-12)
next-sanity/studio
(dev-preview)The latest version of Sanity Studio allows you to embed a near-infinitely configurable content editing interface into any React application. This opens up many possibilities:
Usage
The basic setup is two files:
pages/[[...index]].tsx
import config from '../sanity.config'
import {NextStudio} from 'next-sanity/studio'
export default function StudioPage() {
// Loads the Studio, with all the needed neta tags and global CSS reqiired for it to render correctly
return <NextStudio config={config} />
}
The
<NextStudio />
wraps<Studio />
component and supports forwarding all its props:pages/_document.tsx
// Set up SSR for styled-components, ensuring there's no missing CSS when deploying a Studio in Next.js into production
export default class Document extends ServerStyleSheetDocument {}
Opt-in to using
StudioProvider
andStudioLayout
If you want to go lower level and have more control over the studio you can pass
StudioProvider
andStudioLayout
fromsanity
aschildren
:import {StudioProvider, StudioLayout} from 'sanity'
import config from '../sanity.config'
function StudioPage() {
return (
<NextStudio config={config}>
<StudioProvider config={config}>
{/* Put components here and you'll have access to the same React hooks as Studio gives you when writing plugins */}
<StudioLayout />
</StudioProvider>
</NextStudio>
)
}
Customize
<ServerStyleSheetDocument />
You can still customize
_document.tsx
, the same way you would the default<Document />
component fromnext/document
:export default class Document extends ServerStyleSheetDocument {
static async getInitialProps(ctx: DocumentContext) {
// You can still override renderPage:
const originalRenderPage = ctx.renderPage
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => (props) => <App {...props} />,
})
}
render() {
// do the same stuff as in
next/document
}
}
Full-control mode
If you only need parts of what
<NextStudio />
does for you, but not all of it.No problem. You can import any which one of the components that
<NextStudio />
is importing and assemble them in any way you want.And while
<NextStudio />
have all features enabled by default allowing you to opt-out by giving it props, the inner components<NextStudioHead />
and<NextStudioGlobalStyle />
are opt-in.This means that these two
StudioPage
components are functionally identical:NextStudio,
NextStudioGlobalStyle,
NextStudioHead,
useThem,
useBackgroundColorsFromTheme,
} from 'next-sanity/studio'
import {Studio} from 'sanity'
import config from '../sanity.config'
// Turning all the features off, leaving only bare minimum required meta tags and styling
function StudioPage() {
return (
<NextStudio
config={config}
// an empty string turns off the CSS that sets a background on <html>
unstable__bg=""
unstable__noTailwindSvgFix
unstable__noFavicons
// an empty string turns off the <title> tag
unstable__document_title=""
/>
)
}
// Since no features are enabled it works the same way
function Studiopage() {
const theme = useTheme(config)
const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)
return (
<>
<Studio config={config} />
<NextStudioHead themeColorLight={themeColorLight} themeColorDark={themeColorDark} />
<NextStudioGlobalStyle />
</>
)
}
Features
0.6.12 (2022-08-12)
Bug Fixes
Commit messages
Package name: next-sanity
Compare
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs