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

fix: Deleted pages appear in the page tree #9337

Merged

Conversation

reiji-h
Copy link
Contributor

@reiji-h reiji-h commented Oct 31, 2024

Summary

  • 削除したページがページツリーから消えないことがある問題の修正
  • 特にページを削除した直後に /trash に遷移することでよく起こる

Task

Note

@miya miya requested review from yuki-takei and miya November 1, 2024 09:23
@@ -197,7 +197,7 @@ export const useSWRxPageAncestorsChildren = (
assert(keyMatcherForPageTree(key));
}

return useSWRImmutable(
return useSWR(
Copy link
Member

Choose a reason for hiding this comment

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

useSWRxPageAncestorsChildren の自動 revalidation を許すと、API を叩く回数が増えるのを心配している。

https://swr.vercel.app/ja/docs/revalidation#disable-automatic-revalidations

関係ないトリガーはもう少し抑制できないだろうか。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

useSWRxPageAncestorsChildren の useSWR を Immutable に戻しました。

TreeItemLayout.tsx の受け取る PageTree の情報は、上位から受け取る useSWRxPageAncestorsChildren の childrenA と 41 行目の useSWRxPageChildren の childrenB の2つがありました。/trash に遷移した際、childrenA は削除したものが残っており、childrenB はちゃんと消えていました。常に childrenB の情報のほうが正しかったので、childrenA を受け取るのを辞める形で変更しました。

apps/app/src/client/components/TreeItem/TreeItemLayout.tsx Outdated Show resolved Hide resolved
Copy link

changeset-bot bot commented Nov 18, 2024

⚠️ No Changeset found

Latest commit: 3a71b77

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

mergify bot added a commit that referenced this pull request Nov 22, 2024
@@ -36,7 +36,7 @@ export const TreeItemLayout: FC<TreeItemLayoutProps> = (props) => {

const { page, children } = itemNode;

const [currentChildren, setCurrentChildren] = useState(children);
const [currentChildren, setCurrentChildren] = useState<ItemNode[]>(children);
Copy link
Member

Choose a reason for hiding this comment

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

メモ

こちらのデグレに対応
https://redmine.weseek.co.jp/issues/157808

@mergify mergify bot merged commit 1dab209 into master Nov 22, 2024
22 checks passed
@mergify mergify bot deleted the fix/111603-126863-pagetree-display-the-page-that-is-deleted branch November 22, 2024 13:00
@github-actions github-actions bot mentioned this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants