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

Reload webpages when refreshed #1021

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Reload webpages when refreshed #1021

merged 1 commit into from
Aug 21, 2024

Conversation

ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Aug 21, 2024

Motivation:

After #1013 is merged, I found out that a web page failed to reload when a refresh button is clicked or directly access to /app/projects

It is caused by a bug of Armeria FileService which returns an empty file instead of a non-existent file when 1) the target path is a directory and 2) the path does not end with /.

The FileService has .html as a fallback extension. If /app/projects is requested, I expect /app/projects.html to be returned because /app/projects is directory. However, it only works with FileSystemHttpVfs but not ClassPathHttpVfs.

/app/projects/[projectName].html
/app/projects.html

The problem wasn't caught by unit tests because FileSystemHttpVfs was always used instead. During the tests, the class loader directly loads the test resources from the file system.

Modifications:

  • Always return /webapp/index.html for /app/** paths.
    • Next.js will load the correct page on the client side.

Result:

Fixed a regression where the webapp failed to render deep links.

Motivation:

After line#1013 is merged, I found out that a web page failed to reload when
a refresh button is clicked or directly access to `/app/projects`

It is caused by a bug of Armeria `FileService` which returns an empty
file instead of a non-existent file when 1) the target path is a
directory and the path does not end with `/`.

The `FileService` has `.html` as a fallback extension.
If `/app/projects` is requested, I expect `/app/projects.html` to be
returned because `/app/projects` is directory. However, it only works
with `FileSystemHttpVfs` but not `ClassPathHttpVfs`.
```
/app/projects/[projectName].html
/app/projects.html
```

The problem wasn't caught by unit tests because `FileSystemHttpVfs` was
always used. During the tests, The class loader directly loads by the
test resouces from the file system.

Modifications:

- Always return `/webapp/index.html` for `/app/**` paths.
  - Next.js will load the correct page on the client side.

Result:

Fixed a regression where the webapp failed to render deep links.
@ikhoon ikhoon added the defect label Aug 21, 2024
@ikhoon ikhoon added this to the 0.70.0 milestone Aug 21, 2024
Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

👍 👍 👍

@ikhoon ikhoon merged commit e7d168c into line:main Aug 21, 2024
10 checks passed
@ikhoon ikhoon deleted the refresh-bug branch August 21, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants