Skip to content
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

Merged
merged 8 commits into from
Jan 4, 2024

Conversation

jam411
Copy link
Contributor

@jam411 jam411 commented Dec 4, 2023

task: https://redmine.weseek.co.jp/issues/135811

やったこと

  • サイドバー新規ページ作成同線のうち、template ページ作成(useOnTemplateButtonClicked)と新規ページ作成(useOnNewButtonClicked)で挙動を統一しました。

特に見てほしい仕様

  • /trash /me などでページ作成ボタンを投下すると、page データのキャッシュがあればそのページ配下へページが作成されます。
    • path は useSWRxCurrentPage から取得しています。なので、/trash /me /tags では useSWRxCurrentPage から取得できる page データが swr キャッシュにより、ルートページ配下ではなく、その前に取得していた page 情報になる場合がある。

その他の仕様まとめ(どのページ配下にページを作る/遷移するのか)

  • ページ作成ボタン投下時の page path を取得して、/{path}/{additional_path} パスを作成しページを作る
  • /{path}/{additional_path} がすでに存在していたら:
    • 新規ページ作成では新たな /{path}/{additional_path} を作成
    • tempalte ページ作成では既存ページの編集画面へ遷移
  • /{path}/{additional_path} が作成できないパス(path が Not Found Page や Not Creatable Page なども)であるか、もしくは path を受け取れないときは、ルートページ配下へ /{additional_path} を作成もしくへ編集画面へ遷移する

@jam411 jam411 marked this pull request as draft December 4, 2023 08:04
@yuki-takei
Copy link
Member

  • /trash /me /tags 遷移時の useSWRxCurrentPage キャッシュ対策はしておきたい
    • 遷移時に flush するなど

@yuki-takei
Copy link
Member

yuki-takei commented Dec 8, 2023

/{path}/{additional_path} が作成できないパス(path が Not Found Page や Not Creatable Page なども)であるか、

これは不正確では?
/{path} が not found か not creatable かどうかは、/{path}/{additional_path} を作成可能かとは関係がない。

もしくは path を受け取れないときは、ルートページ配下へ /{additional_path} を作成もしくへ編集画面へ遷移する

これは良いと思う。

@jam411 jam411 marked this pull request as ready for review December 15, 2023 11:17
Comment on lines 168 to 170
const { mutate } = useSWRxCurrentPage();
// clear 'currentPage' cache for page create button
mutate(undefined, { revalidate: false });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useInitSidebarConfig でキャッシュをクリアするようにしました。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここに書くとこの hook を使っているコンポーネントが re-rendering される度に mutate が走るので、ここでやるのは違う

Comment on lines 168 to 170
const { mutate } = useSWRxCurrentPage();
// clear 'currentPage' cache for page create button
mutate(undefined, { revalidate: false });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここに書くとこの hook を使っているコンポーネントが re-rendering される度に mutate が走るので、ここでやるのは違う

Copy link

reg-suit bot commented Jan 4, 2024

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.

@yuki-takei yuki-takei merged commit 5e732f9 into dev/7.0.x Jan 4, 2024
19 of 25 checks passed
@yuki-takei yuki-takei deleted the feat/134154-135811-update-create-page-method branch January 4, 2024 11:13
@github-actions github-actions bot mentioned this pull request Jan 4, 2024
@yuki-takei yuki-takei mentioned this pull request Mar 26, 2024
@github-actions github-actions bot mentioned this pull request Mar 26, 2024
@github-actions github-actions bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants