Skip to content

Conversation

@skyfallwastaken
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 10, 2026 12:57
@skyfallwastaken skyfallwastaken changed the title Clean up code + js rails helper + perf types_from_initializers + js_from_routes + performance fixes Feb 10, 2026
@skyfallwastaken skyfallwastaken merged commit 384a618 into main Feb 10, 2026
12 checks passed
@skyfallwastaken skyfallwastaken deleted the initializers-and-indexes-and-perf-things branch February 10, 2026 13:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces generated TypeScript route helpers and serializer-derived TS types for the Svelte/Inertia frontend, along with dashboard query performance improvements (new indexes + optimized weekly aggregation).

Changes:

  • Add js_from_routes + types_from_serializers tooling/config and update Svelte pages to use generated route helpers and generated TS prop types.
  • Improve dashboard performance by adding partial indexes on heartbeats and replacing per-week queries with a single window-function aggregation.
  • Minor dependency/version bumps and small UI/accessibility tweaks.

Reviewed changes

Copilot reviewed 45 out of 51 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
config/initializers/js_from_routes.rb Configures generation of TS route helpers into app/javascript/api.
config/routes.rb Adds route defaults intended for export/generation.
app/javascript/pages/**/*.svelte Switches hardcoded paths + local prop types to generated route helpers and serializer-derived TS types.
config/initializers/types_from_serializers.rb + app/serializers/**/* Adds serializer DSL and defines typed serializers to generate TS types.
app/models/concerns/heartbeatable.rb + app/controllers/static_pages_controller.rb Adds weekly grouped duration query and uses it to speed up dashboard stats computation.
db/migrate/*_add_indexes_for_dashboard_performance.rb + db/schema.rb Adds concurrent partial indexes to improve dashboard filter/stat queries.
package.json + lockfiles Adds @js-from-routes/inertia and bumps Svelte/tsconfig versions.
.gitignore Ignores generated route helper + generated serializer TS type output directories.
app/javascript/layouts/AppLayout.svelte Accessibility-related markup changes and minor state logic adjustments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</svg>
</button>
<div class="nav-overlay" class:open={navOpen} onclick={closeNav}></div>
<div class="nav-overlay" class:open={navOpen} onclick={closeNav} role="button" tabindex="0" onkeydown={(e) => e.key === 'Enter' && closeNav()}></div>
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The nav overlay is given role="button" and keyboard handling, but it only closes on Enter. For button-like elements, Space should also activate the action; otherwise keyboard users may not be able to dismiss the overlay reliably. Consider handling both Enter and Space (or use a real <button> element).

Suggested change
<div class="nav-overlay" class:open={navOpen} onclick={closeNav} role="button" tabindex="0" onkeydown={(e) => e.key === 'Enter' && closeNav()}></div>
<div class="nav-overlay" class:open={navOpen} onclick={closeNav} role="button" tabindex="0" onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') { e.preventDefault(); closeNav(); } }}></div>

Copilot uses AI. Check for mistakes.
Comment on lines +420 to +423
role="button"
tabindex="-1"
aria-label="Close logout modal"
onkeydown={(e) => e.key === 'Escape' && closeLogout()}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This backdrop is marked role="button" with an Escape key handler, but tabindex="-1" means it won’t receive focus via keyboard navigation, so the key handler is unlikely to fire. Since you already register a document-level Escape handler, consider removing the button semantics here (e.g., use role="presentation"/no role) to avoid exposing a non-interactive ‘button’ to assistive tech.

Suggested change
role="button"
tabindex="-1"
aria-label="Close logout modal"
onkeydown={(e) => e.key === 'Escape' && closeLogout()}

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +25
root "static_pages#index", defaults: { export: true }

resources :extensions, only: [ :index ]
resources :extensions, only: [ :index ], defaults: { export: true }
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Adding defaults: { export: true } to these routes will change Rails URL helper output (e.g., root_path becomes /?export=true). That will break existing current_page?(root_path) checks and server-rendered links/redirects that expect / (no query string). Consider using a route-tagging approach that doesn’t alter generated URLs, or ensure callers pass export: nil / update current_page? usage accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines 8 to 12
"@fontsource/inter": "^5.2.8",
"@inertiajs/svelte": "^2.3.13",
"@js-from-routes/inertia": "^1.10.2",
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tailwindcss/forms": "^0.5.11",
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

@js-from-routes/inertia pulls in @inertiajs/inertia@0.11.1, which is marked deprecated in the lockfile and brings an old axios@0.21.x dependency. Please confirm this is intentional and upgrade/swap to a maintained client library that doesn’t require the deprecated Inertia v0 package (or explicitly depend on a secure axios version if unavoidable).

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +8
JsFromRoutes.config do |config|
config.client_library = "@js-from-routes/inertia"
config.file_suffix = "Api.ts"
config.all_helpers_file = "index.ts"
config.output_folder = Rails.root.join("app/javascript/api")
end
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

config.output_folder points to app/javascript/api, but that directory is currently absent and is now gitignored. Since the Svelte code imports from ../../api, a clean checkout/build will fail unless the routes file is generated as part of the build/dev startup. Please add an explicit generation step (CI/build script or bin/setup/bin/dev hook) or commit the generated output instead of ignoring it.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +7
if Rails.env.development? then
TypesFromSerializers.config do |config|
config.output_dir = Rails.root.join("app/javascript/types/serializers")
config.custom_types_dir = Rails.root.join("app/javascript/types")
config.transform_keys = ->(key) { key.to_s }
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Similarly, TypesFromSerializers writes to app/javascript/types/serializers, but the directory is absent and gitignored while the frontend imports these types. Please ensure types are generated automatically before TypeScript/Svelte compilation (or commit them) so fresh clones and deploy builds don’t fail.

Copilot uses AI. Check for mistakes.
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.

1 participant