5
11
Fork
You've already forked tomato
1

Switch from rails UJS to turbo #55

Merged
edwardloveall merged 8 commits from el-turbo into main 2025年12月08日 17:07:44 +01:00

Turbo is the evolution from the old rails turbolinks. It offers faster page reloads by preloading pages on hover, and replacing the existing DOM with the new page instead of doing a full page refresh. It also offers functionality that we'd like to start using, like turbo frames. Turbo also helps us get away from React.

Keeping a single page in memory is not without complications, however. This PR aims to wangle those complexities. I tried to add context/rationale/details on each commit here to help explain my thinking.

[Turbo](https://turbo.hotwired.dev/) is the evolution from the old rails turbolinks. It offers faster page reloads by preloading pages on hover, and replacing the existing DOM with the new page instead of doing a full page refresh. It also offers functionality that we'd like to start using, like turbo frames. Turbo also helps us get away from React. Keeping a single page in memory is not without complications, however. This PR aims to wangle those complexities. I tried to add context/rationale/details on each commit here to help explain my thinking.
@ -0,0 +18,4 @@
});
// eslint-disable-next-line prefer-const
let state = [];
Author
Owner
Copy link

This is probably the nastiest thing in here. I didn't really take time to refactor it, just make it work. If it's a const the page will throw errors about redefining consts, so I made it a global var. In the future I'd like to make this a web component or stimulus controller. Haven't decided which.

This is probably the nastiest thing in here. I didn't really take time to refactor it, just make it work. If it's a `const` the page will throw errors about redefining `const`s, so I made it a global `var`. In the future I'd like to make this a web component or stimulus controller. Haven't decided which.
edwardloveall force-pushed el-turbo from 038a8d9cca
Some checks failed
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Failed
to ca7f760b0f
Some checks failed
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Failed
2025年12月04日 21:30:40 +01:00
Compare
@ -0,0 +20,4 @@
} else {
thisRadio.disabled = false;
thisRadio.checked = true;
allRadio.disabled = false;
First-time contributor
Copy link

This value is false in both cases. Is that intentional?

This value is false in both cases. Is that intentional?
Author
Owner
Copy link

Good catch. It was leftover from the conversion from the page script (line 355-ish). We used to do something different if the event in question wasn't a recurrence, but now we just let the form go through so this isn't needed. Removed!

Good catch. It was leftover from the conversion from the [page script](https://codeberg.org/rootable/tomato/pulls/55/files#diff-210f5b69fb9764e59f8daca2bf4f9ec46faa3d15) (line 355-ish). We used to do something different if the event in question wasn't a recurrence, but now we just let the form go through so this isn't needed. Removed!
edwardloveall force-pushed el-turbo from ca7f760b0f
Some checks failed
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Failed
to 3578fb87b8
Some checks failed
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Failed
2025年12月08日 16:49:49 +01:00
Compare
Author
Owner
Copy link

Failing rspec tests are flaky and pass locally. I think there's something going on with the seeds in the test. I'll try to check that out this week so they become more stable.

Failing rspec tests are flaky and pass locally. I think there's something going on with the seeds in the test. I'll try to check that out this week so they become more stable.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato!55
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "el-turbo"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?