@inertiaui/modal-react 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inertiaui/modal-react",
3
3
  "author": "Pascal Baljet <pascal@protone.media>",
4
- "version": "3.0.0",
4
+ "version": "3.1.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "devDependencies": {
37
37
  "@heroicons/react": "^2.1.4",
38
38
  "@inertiajs/react": "^3.0.0",
39
- "@inertiaui/vanilla": "^0.3.0",
39
+ "@inertiaui/vanilla": "^1.0.0",
40
40
  "@testing-library/react": "^16.0.0",
41
41
  "@types/react": "^19.0.0",
42
42
  "@types/react-dom": "^19.0.0",
@@ -57,11 +57,11 @@
57
57
  "vitest": "^4.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@inertiaui/vanilla": "^0.3.0"
60
+ "@inertiaui/vanilla": "^1.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@inertiajs/react": "^3.0.0",
64
64
  "react": "^19.0.0",
65
65
  "react-dom": "^19.0.0"
66
66
  }
67
- }
67
+ }
@@ -138,7 +138,7 @@ const HeadlessModal = forwardRef<HeadlessModalRef, HeadlessModalProps>(
138
138
  const previousIsOpenRef = useRef<boolean | undefined>(undefined)
139
139
 
140
140
  useEffect(() => {
141
- if (modalContext !== null) {
141
+ if (modalContext != null) {
142
142
  if (modalContext.isOpen) {
143
143
  onSuccess?.()
144
144
  } else if (previousIsOpenRef.current === true) {
@@ -153,7 +153,7 @@ const HeadlessModal = forwardRef<HeadlessModalRef, HeadlessModalProps>(
153
153
  const [rendered, setRendered] = useState(false)
154
154
 
155
155
  useEffect(() => {
156
- if (rendered && modalContext !== null && modalContext.isOpen) {
156
+ if (rendered && modalContext != null && modalContext.isOpen) {
157
157
  if (modalContext.onTopOfStack) {
158
158
  onFocus?.()
159
159
  } else {
package/src/ModalRoot.tsx CHANGED
@@ -260,7 +260,11 @@ export const ModalStackProvider = ({ children }: ModalStackProviderProps) => {
260
260
  // Only suppresses navigate events to this specific URL
261
261
  closingToBaseUrlTarget = savedBaseUrl
262
262
 
263
- if (savedBaseUrl && typeof window !== 'undefined') {
263
+ // Only call router.push() when the URL actually changed (navigate mode).
264
+ // In non-navigate mode (default), the URL never changes and _inertiaui_modal
265
+ // is never in page props, so router.push() would be a no-op that triggers
266
+ // an unnecessary full component re-render in Inertia v3.
267
+ if (savedBaseUrl && typeof window !== 'undefined' && !sameUrlPath(savedBaseUrl, window.location.href)) {
264
268
  router.push({
265
269
  url: savedBaseUrl,
266
270
  preserveScroll: true,