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

Restructure to avoid internal window.Turbo access #1078

Merged

Conversation

seanpdoyle
Copy link
Contributor

Replace accessing the recentRequests property through the window.Turbo.session object.

In its place, restructure the object's dependency graph so that the http/fetch module constructs the LimitedSet instance, and the Session accepts that instance as a property.

Copy link
Member

@jorgemanrubia jorgemanrubia left a comment

Choose a reason for hiding this comment

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

👍 thanks @seanpdoyle

@jorgemanrubia
Copy link
Member

jorgemanrubia commented Nov 27, 2023

ah @seanpdoyle could you please rebase to solve conflicts?

@seanpdoyle seanpdoyle force-pushed the replace-window-turbo-access-from-fetch branch from db84bb5 to 586f811 Compare November 27, 2023 14:21
Replace accessing the `recentRequests` property through the
`window.Turbo.session` object.

In its place, restructure the object's dependency graph so that the
`http/fetch` module constructs the `LimitedSet` instance, and the
`Session` accepts that instance as a property.
@seanpdoyle seanpdoyle force-pushed the replace-window-turbo-access-from-fetch branch from 586f811 to 23d0cb4 Compare November 27, 2023 14:33
@jorgemanrubia jorgemanrubia merged commit 5d7ff7c into hotwired:main Nov 27, 2023
1 check passed
@seanpdoyle seanpdoyle deleted the replace-window-turbo-access-from-fetch branch November 27, 2023 14:57
seanpdoyle added a commit to seanpdoyle/turbo that referenced this pull request Dec 1, 2023
Follow-up to [hotwired#1049][]
Follow-up to [hotwired#1073][]
Related to [hotwired#1078][]

Replace an internal `window.Turbo.session` access with an `import {
session }` statement.

Prior attempts at this change introduced circular dependencies. This
attempt does not. Additionally, this change maintains the ability for
consumers to access StreamActions through `window.Turbo.StreamActions`,
while also enabling `import { StreamActions } from "@hotwired/turbo"`
(or `from "@hotwired/turbo-rails"`).

[hotwired#1049]: hotwired#1049
[hotwired#1073]: hotwired#1073
[hotwired#1078]: hotwired#1078
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants