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: generate views.json under frontend/generated in dev mode #2234

Merged
merged 14 commits into from
Mar 26, 2024

Conversation

taefi
Copy link
Contributor

@taefi taefi commented Mar 19, 2024

Description

This changes the location for generating the views.json
(handled by hilla-file-router/src/vite-plugin.ts) to
frontend/generated/ in dev mode. This doesn't change
the location in production mode so it can be loaded as
a resource.

In dev mode, every time the vite-plugin detects changes
in views and generates a new views.json, it sends a
'full-reload' command to the browser, so that the client
requests for index.html to cause a the listener to reload
the latest changes and to modify the response.

Fixes #2213

This PR is followed up by vaadin/flow#19025 so that the
newly added plugin option isDevMode could be
initialized properly by the vite.generated.ts

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.77%. Comparing base (ab47af1) to head (c072b2e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2234   +/-   ##
=======================================
  Coverage   93.77%   93.77%           
=======================================
  Files          65       65           
  Lines        1639     1639           
  Branches      368      368           
=======================================
  Hits         1537     1537           
  Misses         67       67           
  Partials       35       35           
Flag Coverage Δ
unittests 93.77% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@taefi taefi marked this pull request as ready for review March 24, 2024 20:33
taefi added a commit to vaadin/flow that referenced this pull request Mar 24, 2024
This passes the deployment mode to the FS Router vite plugin
so that it can decide where to generate needed file at runtime.

Related to: vaadin/hilla#2234
@taefi taefi requested a review from Lodin March 25, 2024 09:47
mshabarov pushed a commit to vaadin/flow that referenced this pull request Mar 25, 2024
* feat: pass deployment mode to FS Router vite plugin

This passes the deployment mode to the FS Router vite plugin
so that it can decide where to generate needed file at runtime.

Related to: vaadin/hilla#2234

* fix tests

* formatter:format
Copy link

sonarcloud bot commented Mar 26, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@taefi taefi merged commit 2b7ef94 into main Mar 26, 2024
15 checks passed
@taefi taefi deleted the taefi/dev-mode-views-json-in-generated branch March 26, 2024 09:18
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.4.0.alpha18 and is also targeting the upcoming stable 24.4.0 version.

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

Successfully merging this pull request may close these issues.

Creating/updating views.json under resources causes unnecessary extra restarts during the startup
3 participants