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

Add InstantClick behavior #1101

Merged
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
273456a
Move doesNotTargetIFrame to util.js
davidalejandroaguilar Dec 5, 2023
1df1428
Move findLinkFromClickTarget to util.js
davidalejandroaguilar Dec 5, 2023
2f8c272
Move getLocationForLink to util.js
davidalejandroaguilar Dec 5, 2023
de3ffcf
Allow request to be intercepted and overriden on turbo:before-fetch-r…
davidalejandroaguilar Dec 3, 2023
94ff0e1
Add instantclick behavior
davidalejandroaguilar Dec 5, 2023
e662690
Allow customizing the event that triggers prefetching
davidalejandroaguilar Dec 6, 2023
15517d4
Allow customizing the cache time for prefetching
davidalejandroaguilar Dec 6, 2023
ab0e538
Rename LinkPrefetchOnMouseoverObserver to LinkPrefetchObserver
davidalejandroaguilar Dec 6, 2023
fca147e
Use private methods in LinkPrefetchObserver
davidalejandroaguilar Dec 6, 2023
3baf81c
Reorganize methods on LinkPrefetchObserver
davidalejandroaguilar Dec 6, 2023
d2ec021
Require a shorter sleep time in the test
davidalejandroaguilar Dec 6, 2023
7c7ded9
Standardize anchor IDs in link_prefetch_observer_tests
davidalejandroaguilar Dec 6, 2023
806aa9d
Don't try traverse DOM to determine if the target is a link
davidalejandroaguilar Dec 9, 2023
39e3dda
Keep the closing tag on the same line as the rest of the tag
davidalejandroaguilar Dec 9, 2023
9cdff6d
Remove unnecessary nesting in tests
davidalejandroaguilar Dec 9, 2023
368225a
Add missing newline at end of file
davidalejandroaguilar Dec 9, 2023
3e75161
Check for prefetch meta tag before prefetching (on hover event)
davidalejandroaguilar Dec 9, 2023
b9e82f2
Use FetchRequest to build request for LinkPrefetchObserver
davidalejandroaguilar Dec 9, 2023
ab01099
Add Turbo Stream header to Accept header when link has data-turbo-stream
davidalejandroaguilar Dec 9, 2023
c735036
Bring back prefetching links with inner elements
davidalejandroaguilar Dec 9, 2023
b27bc42
Add cancelable delay to prefetching links on hover
davidalejandroaguilar Dec 9, 2023
4c86295
Fix clearing cache on every prefetch after b9e82f2
davidalejandroaguilar Dec 9, 2023
4170ddb
Add tests for the delay on the meta tag
davidalejandroaguilar Dec 9, 2023
5078e0b
Use mouseenter and mouseleave instead of mouseover and mouseout
davidalejandroaguilar Dec 9, 2023
3d2665a
Remove unneeded comment
davidalejandroaguilar Dec 9, 2023
3a724ca
Merge branch 'main' into davidramos-add-instantclick-behavior
davidalejandroaguilar Dec 11, 2023
efd58fb
Use double quotes instead of single quotes for consistency
davidalejandroaguilar Jan 7, 2024
10e1311
Move link variable declaration inside if statement
davidalejandroaguilar Jan 7, 2024
5326a0f
Use correct key name for mouseenter event on LinkPrefetchObserver.tri…
davidalejandroaguilar Jan 7, 2024
a551b1f
Allow prefetching when visiting page without meta, then visiting one …
davidalejandroaguilar Jan 7, 2024
ebea951
Allow create and delete posts with comments on the test server
davidalejandroaguilar Jan 7, 2024
aa6f013
Clear prefetch cache after form submission
davidalejandroaguilar Jan 8, 2024
851dabb
Add test for nested data-turbo-prefetch=true within data-turbo-prefet…
davidalejandroaguilar Jan 16, 2024
ccab6b2
No longer allow customizing the prefetch trigger event
davidalejandroaguilar Jan 16, 2024
06181be
No longer allow customizing the prefetch delay
davidalejandroaguilar Jan 16, 2024
0704cef
Add touchstart event to prefetch observer
davidalejandroaguilar Jan 16, 2024
80524d5
Merge branch 'main' into davidramos-add-instantclick-behavior
davidalejandroaguilar Jan 16, 2024
c975a7b
Fix flaky tests
davidalejandroaguilar Jan 16, 2024
e87bf75
Use double quotes instead of single quotes
davidalejandroaguilar Jan 16, 2024
1b376c8
Only cache the link you're currently hovering
afcapel Jan 17, 2024
c944326
Remove unused files after ETA template rendered removal
davidalejandroaguilar Jan 18, 2024
63908d0
Remove unused variable
davidalejandroaguilar Jan 18, 2024
1c9b41c
Clear prefetch cache when the link is no longer hovered
davidalejandroaguilar Jan 18, 2024
ac310e2
Merge remote-tracking branch 'origin/main' into davidramos-add-instan…
afcapel Jan 22, 2024
70935c4
Style changes
afcapel Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Require a shorter sleep time in the test
Since turbo-prefetch-cache-time is set to 1 millisecond in the html fixture
davidalejandroaguilar committed Dec 6, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit d2ec0211274106180996a0dd2e1ed210001a268a
2 changes: 1 addition & 1 deletion src/tests/functional/link_prefetch_observer_tests.js
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ test.describe("when hovering over a link", () => {
test("it caches the request for 1 second", async ({ page }) => {
await assertPrefetchedOnHover({ page, selector: "#prefetch_anchor" })

await sleep(1100)
await sleep(10)
await page.mouse.move(0, 0)

await assertPrefetchedOnHover({ page, selector: "#prefetch_anchor" })