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: correct router logic #2342

Merged
merged 13 commits into from
May 12, 2023
Merged

fix: correct router logic #2342

merged 13 commits into from
May 12, 2023

Conversation

himself65
Copy link
Contributor

@himself65 himself65 commented May 12, 2023

Now, we only listen to the routeChangeStart and don't case other things.

@codesandbox
Copy link

codesandbox bot commented May 12, 2023

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders | Preview

@vercel
Copy link

vercel bot commented May 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
affine-preview 🛑 Canceled (Inspect) May 12, 2023 5:46am
affine-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 12, 2023 5:46am

@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:38 — with GitHub Actions Inactive
@github-actions github-actions bot added the mod:workspace Related to workspace label May 12, 2023
@perfsee
Copy link

perfsee bot commented May 12, 2023

affine-toeverything

Bundle main

diff ------------------- Bundle Size Diff -------------------------

@@                       EntryPoint: main                        @@
##                     master …5/0511-router                 +/- ##
===================================================================
< Bundle              3.11 MB        3.18 MB    +65.7 kB(+2.11%)   
< Initial JS          1.86 MB        1.88 MB    +19.2 kB(+1.03%)   
< Initial CSS         16.8 kB        33.9 kB  +17.2 kB(+102.45%)   
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
< Assets                   41             48                  +7   
< Chunks                   39             42                  +3   
< Packages                132            138                  +6   
= Duplicates                3              3                       
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Warnings ~~~~~~~~~~~~~~~~~~~~~~~~~~~#
! Separate mixed content assets files                              
! Avoid cache wasting                                              

@@                    EntryPoint: pages/_app                     @@
##                     master …5/0511-router                 +/- ##
===================================================================
< Bundle                 3 MB        3.05 MB    +56.3 kB(+1.88%)   
< Initial JS          1.75 MB        1.76 MB     +9.8 kB(+0.56%)   
< Initial CSS         16.8 kB        33.9 kB  +17.2 kB(+102.45%)   
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
< Assets                   39             46                  +7   
< Chunks                   37             40                  +3   
< Packages                132            138                  +6   
= Duplicates                3              3                       
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Warnings ~~~~~~~~~~~~~~~~~~~~~~~~~~~#
! Separate mixed content assets files                              
! Avoid cache wasting                                              

@@                   EntryPoint: pages/_error                    @@
##                     master …5/0511-router                 +/- ##
===================================================================
= Bundle              16.6 kB        16.6 kB                       
= Initial JS          16.6 kB        16.6 kB                       
= Initial CSS             0 B            0 B                       
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
= Assets                    2              2                       
= Chunks                    2              2                       
= Packages                  5              5                       
= Duplicates                0              0                       

...and more

@cloudflare-pages
Copy link

cloudflare-pages bot commented May 12, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2dda82a
Status: ✅  Deploy successful!
Preview URL: https://959921f6.affine.pages.dev
Branch Preview URL: https://himself65-0511-router.affine.pages.dev

View logs

@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Patch coverage: 91.42% and project coverage change: +0.01 🎉

Comparison is base (10b4558) 72.60% compared to head (2dda82a) 72.61%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2342      +/-   ##
==========================================
+ Coverage   72.60%   72.61%   +0.01%     
==========================================
  Files         333      328       -5     
  Lines        7252     7182      -70     
  Branches     1145     1126      -19     
==========================================
- Hits         5265     5215      -50     
+ Misses       1778     1766      -12     
+ Partials      209      201       -8     
Flag Coverage Δ
e2etest 67.13% <85.71%> (-0.09%) ⬇️
e2etest-macos-latest-x64 ?
e2etest-ubuntu-latest-x64 47.95% <65.71%> (-0.19%) ⬇️
e2etest-windows-latest-x64 ?
server-test 73.14% <ø> (ø)
storybook-test 55.86% <ø> (ø)
unittest 40.75% <79.16%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...web/src/pages/workspace/[workspaceId]/[pageId].tsx 70.45% <ø> (-0.66%) ⬇️
apps/web/src/pages/workspace/[workspaceId]/all.tsx 73.91% <ø> (-1.09%) ⬇️
.../web/src/pages/workspace/[workspaceId]/setting.tsx 64.70% <ø> (-0.68%) ⬇️
...ps/web/src/pages/workspace/[workspaceId]/trash.tsx 57.89% <ø> (-2.11%) ⬇️
...pps/web/src/hooks/current/use-current-workspace.ts 88.88% <50.00%> (-11.12%) ⬇️
packages/workspace/src/atom.ts 87.87% <90.90%> (+6.06%) ⬆️
apps/web/src/layouts/workspace-layout.tsx 90.27% <100.00%> (+0.99%) ⬆️
apps/web/src/pages/index.tsx 63.33% <100.00%> (ø)
apps/web/src/providers/modal-provider.tsx 89.79% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@himself65 himself65 temporarily deployed to development May 12, 2023 04:41 — with GitHub Actions Inactive
@vercel vercel bot temporarily deployed to Preview – affine-preview May 12, 2023 04:44 Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:44 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:44 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:44 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:45 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:45 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:45 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:45 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 04:45 — with GitHub Actions Inactive
@vercel vercel bot temporarily deployed to Preview – affine-storybook May 12, 2023 04:48 Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:33 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:35 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:35 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:35 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:35 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:35 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:35 — with GitHub Actions Inactive
@@ -0,0 +1,139 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved this test into a new file because I found that next-router-mock has some corner case which might not isolate with other test case

rootCurrentPageIdAtom.onMount = set => {
if (typeof window !== 'undefined') {
const callback = (url: string) => {
const value = url.split('/')[3];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hard code here, but it's ok because we don't have other use cases

@himself65 himself65 temporarily deployed to development May 12, 2023 05:38 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@vercel vercel bot temporarily deployed to Preview – affine-preview May 12, 2023 05:41 Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@himself65 himself65 temporarily deployed to development May 12, 2023 05:41 — with GitHub Actions Inactive
@vercel vercel bot temporarily deployed to Preview – affine-storybook May 12, 2023 05:46 Inactive
useEffect(() => {
const id = setTimeout(() => {
if (!exist) {
void push('/');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This avoids entering a nonexisting workspace. we will fallback to the index page

@himself65 himself65 merged commit 21fdced into master May 12, 2023
10 checks passed
@himself65 himself65 deleted the himself65/0511-router branch May 12, 2023 05:55
himself65 added a commit that referenced this pull request May 12, 2023
@@ -152,7 +152,7 @@ export function Modals() {
setOpenCreateWorkspaceModal(false);
setOpenWorkspacesModal(false);
setCurrentWorkspace(id);
return jumpToSubPath(id, WorkspaceSubPath.SETTING);
return jumpToSubPath(id, WorkspaceSubPath.ALL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a requirement for creating new workspace that we will redirect to the settings pages after creation.

himself65 added a commit that referenced this pull request May 12, 2023
Brooooooklyn pushed a commit that referenced this pull request May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:web mod:workspace Related to workspace
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants