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 issue not reload on Linux by always read html from index.html #200

Merged
merged 3 commits into from
Jul 16, 2022

Conversation

ntt261298
Copy link
Collaborator

@ntt261298 ntt261298 commented Jul 16, 2022

Summary/ Motivation (TLDR;)

Related issues

Fixes

  • Fix Jest Preview Dashboard does not reload automatically
    • Move "clear cache" code out of server.listen callback
    • Always write index.html to make sure it's always existed
    • Do not generate "blank page" on demand (app.use('/')), instead, write to disk at 2.
  • (As a result), the online demo is fixed

We also tried another approach here (generate a new file name for index.html each time the server starts), we can keep this as a reference #199

@ntt261298 ntt261298 requested a review from nvh95 July 16, 2022 07:44
@netlify
Copy link

netlify bot commented Jul 16, 2022

Deploy Preview for jest-preview-library ready!

Name Link
🔨 Latest commit 82fa65a
🔍 Latest deploy log https://app.netlify.com/sites/jest-preview-library/deploys/62d2769ac65a0c000aea0ba8
😎 Deploy Preview https://deploy-preview-200--jest-preview-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ntt261298 ntt261298 mentioned this pull request Jul 16, 2022
@nvh95 nvh95 changed the title refactor: Always read html from index file Fix issue not reload on Linux by always read html from index.html Jul 16, 2022
Copy link
Owner

@nvh95 nvh95 left a comment

Choose a reason for hiding this comment

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

LGTM! I will also do a round of testing and we are good to merge.

</html>`);
}
let indexHtml = fs.readFileSync(INDEX_PATH, 'utf8');
let indexHtml = fs.readFileSync(INDEX_PATH, 'utf-8');
Copy link
Owner

Choose a reason for hiding this comment

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

TIL that we can use utf8 and utf-8 interchangeably.
Reference: https://stackoverflow.com/a/14551669/3422559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants