Skip to content

Commit

Permalink
chore: bump version to 2.2.0 and update CHANGELOG to reflect removal …
Browse files Browse the repository at this point in the history
…of next.js useRouter support
  • Loading branch information
pciosek committed Dec 30, 2024
1 parent b2ce141 commit 045bab2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# react-content-manager

## 2.2.0

### Minor Changes

- Removed support to execute useRouter from next.js, because it blocked way to work with Vite and forces developer to always refresh RSC (react server components). If you want to still have this feature you can pass it inside onSuccess/onFailure as params of saveChange

## 2.1.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-content-manager",
"version": "2.1.5",
"version": "2.2.0",
"description": "enable editable components in your react app",
"keywords": [
"react",
Expand Down
9 changes: 1 addition & 8 deletions src/context/CMConfigContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export const CMConfigContextProvider = (
const [isSaving, setIsSaving] = useState(false);
const [api, contextHolder] = notification.useNotification();

let nextRouter = null;
// @TODO remove it or load it a way that it will support Vite
nextRouter = require("next/navigation").useRouter();

const setModeHandler = useCallback(
(mode: "edit" | "view") => {
setMode(mode);
Expand All @@ -61,9 +57,6 @@ export const CMConfigContextProvider = (
setIsSaving(true);
const persister = getPersister();
await persister(configId, componentId, props);
if (nextRouter) {
nextRouter.refresh();
}
if (onSuccess) {
onSuccess();
} else {
Expand All @@ -88,7 +81,7 @@ export const CMConfigContextProvider = (
setIsSaving(false);
}
},
[nextRouter],
[],
);

const contextValue: CMConfigContextProps = {
Expand Down

0 comments on commit 045bab2

Please sign in to comment.