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 iframe re-loading when serving certain fixtures #358

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

askoufis
Copy link
Contributor

@askoufis askoufis commented Jun 3, 2024

When serving either the basic or the typescript fixture locally (via build:basic && serve:basic or build:typescript && serve:typescript), each iframe would re-load on every code change. This shouldn't happen when using paramType: 'hash' because hash replacements typically don't cause page navigation.

It turns out that the culprit was the default behaviour of the serve CLI. By default, cleanUrls is true. This results in all requests for .html files being redirected to the same path but without .html (see screenshot). This was occurring for iframe updates, which point directly to /frame.html, resulting in a navigation and full re-load of the frame.

image

The fix is to exclude /frame.html from this behaviour by configuring this inside a serve.json file in each fixture directory.

It turns out the themed fixture already had a serve.json configuration, but it was just blanket-disabling this behaviour for all paths, which doesn't really achieve anything, but it means that you have to explicitly navigate to /index.html to get the themed fixture to load locally, which is annoying.

Note

If you test this locally, you might still see the full re-load happening. This is probably due to your browser cache. Disabling it for the page, or forcing a full page reload should fix it.

@askoufis askoufis requested a review from a team as a code owner June 3, 2024 05:13
Copy link

changeset-bot bot commented Jun 3, 2024

⚠️ No Changeset found

Latest commit: eea86d2

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

Copy link
Contributor

@felixhabib felixhabib left a comment

Choose a reason for hiding this comment

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

🚀

@askoufis askoufis enabled auto-merge (squash) June 4, 2024 02:49
@askoufis askoufis merged commit e2bd356 into master Jun 4, 2024
6 checks passed
@askoufis askoufis deleted the fix-serve-rerender branch June 4, 2024 02:53
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