-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Uniform behavior when creating pages from create new page button #8297
feat: Uniform behavior when creating pages from create new page button #8297
Conversation
|
これは不正確では?
これは良いと思う。 |
apps/app/src/pages/utils/commons.ts
Outdated
const { mutate } = useSWRxCurrentPage(); | ||
// clear 'currentPage' cache for page create button | ||
mutate(undefined, { revalidate: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useInitSidebarConfig でキャッシュをクリアするようにしました。
- useCurrentPagePath の中で読んでいる useSWRxCurrentPage のキャッシュを消す必要がありました。
- mutate を使っているのは https://swr.vercel.app/docs/advanced/cache#modify-the-cache-data を参照
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここに書くとこの hook を使っているコンポーネントが re-rendering される度に mutate が走るので、ここでやるのは違う
apps/app/src/pages/utils/commons.ts
Outdated
const { mutate } = useSWRxCurrentPage(); | ||
// clear 'currentPage' cache for page create button | ||
mutate(undefined, { revalidate: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここに書くとこの hook を使っているコンポーネントが re-rendering される度に mutate が走るので、ここでやるのは違う
…11-update-create-page-method
reg-suit detected visual differences. Check this report, and review them. 🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴 What do the circles mean?The number of circles represent the number of changed images.🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items How can I change the check status?If reviewers approve this PR, the reg context status will be green automatically. |
task: https://redmine.weseek.co.jp/issues/135811
やったこと
特に見てほしい仕様
/trash
/me
などでページ作成ボタンを投下すると、page データのキャッシュがあればそのページ配下へページが作成されます。useSWRxCurrentPage
から取得しています。なので、/trash
/me
/tags
では useSWRxCurrentPage から取得できる page データが swr キャッシュにより、ルートページ配下ではなく、その前に取得していた page 情報になる場合がある。その他の仕様まとめ(どのページ配下にページを作る/遷移するのか)
/{path}/{additional_path}
パスを作成しページを作る/{path}/{additional_path}
がすでに存在していたら:/{path}/{additional_path}
を作成/{path}/{additional_path}
が作成できないパス(path が Not Found Page や Not Creatable Page なども)であるか、もしくは path を受け取れないときは、ルートページ配下へ/{additional_path}
を作成もしくへ編集画面へ遷移する