page-transition 0.1.0-beta.36 → 0.1.0-beta.38

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/README.md CHANGED
@@ -10,7 +10,7 @@ A page transition library for the Next.js App Router.
10
10
  - Scroll restoration
11
11
 
12
12
  ## Install
13
- ![Version](https://img.shields.io/badge/v_0.1.0--beta.35-000000) ![78.5 KB](https://img.shields.io/badge/78.5_KB-1677FF)
13
+ ![Version](https://img.shields.io/badge/v_0.1.0--beta.37-000000) ![78.5 KB](https://img.shields.io/badge/79.5_KB-1677FF)
14
14
 
15
15
  `npm install page-transition@beta`
16
16
 
@@ -131,12 +131,22 @@ export function useHandleLinkClick({ container, handleLinkClick, currentPathname
131
131
  target: 0,
132
132
  duration: duration.current ?? 0
133
133
  }).then(() => {
134
- transitionEnd({
135
- transitionEndObj: push,
136
- transitionEndHandler,
137
- reverse,
138
- delayStep
139
- });
134
+ if (basePathUrl === currentPathname.current) {
135
+ transitionEnd({
136
+ transitionEndObj: afterExit,
137
+ transitionEndHandler,
138
+ reverse,
139
+ delayStep
140
+ });
141
+ }
142
+ else {
143
+ transitionEnd({
144
+ transitionEndObj: push,
145
+ transitionEndHandler,
146
+ reverse,
147
+ delayStep
148
+ });
149
+ }
140
150
  container.current?.classList.remove('enter');
141
151
  container.current?.classList.add('exit');
142
152
  state.current = 'exiting';
@@ -68,11 +68,7 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
68
68
  }
69
69
  rejectFn.current?.();
70
70
  container.current?.classList.remove('enter');
71
- requestAnimationFrame(() => {
72
- requestAnimationFrame(() => {
73
- container.current?.classList.add('exit');
74
- });
75
- });
71
+ container.current?.classList.add('exit');
76
72
  state.current = 'exiting';
77
73
  transitionEnd({
78
74
  transitionEndObj: pop,
@@ -89,7 +85,6 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
89
85
  resolveUseFn.current = reject;
90
86
  new Promise((resolveNavigating) => {
91
87
  if (state.current === "navigating") {
92
- console.log('navigating');
93
88
  if (currentPathname.current !== window.location.pathname) {
94
89
  resolveFn.current?.();
95
90
  setPromise(null);
@@ -134,12 +129,22 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
134
129
  target: 0,
135
130
  duration: duration.current ?? 0
136
131
  }).then(() => {
137
- transitionEnd({
138
- transitionEndObj: pop,
139
- transitionEndHandler,
140
- reverse,
141
- delayStep
142
- });
132
+ if (currentPathname.current === window.location.pathname) {
133
+ transitionEnd({
134
+ transitionEndObj: afterExit,
135
+ transitionEndHandler,
136
+ reverse,
137
+ delayStep
138
+ });
139
+ }
140
+ else {
141
+ transitionEnd({
142
+ transitionEndObj: pop,
143
+ transitionEndHandler,
144
+ reverse,
145
+ delayStep
146
+ });
147
+ }
143
148
  container.current?.classList.remove('enter');
144
149
  container.current?.classList.add('exit');
145
150
  state.current = 'exiting';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "page-transition",
3
- "version": "0.1.0-beta.36",
3
+ "version": "0.1.0-beta.38",
4
4
  "description": "A page transition library for the Next.js App Router.",
5
5
  "license": "MIT",
6
6
  "files": [