Skip to content

Allow specifying worker script location as absolute or relative to current path #2056

@astraw

Description

@astraw

Problem
In older yew (0.15 and earlier), worker scripts were specified with a name relative to the main script. Now, I must anticipate the final URL of my scripts and specify any leading path components in Agent::name_of_resource() because this is now treated as relative to the origin and thus absolute. However, it would be useful to allow the relative behavior again as this would allow yew apps (with workers) to be dropped into a directory not at the root of a website,

One could potentially call this a regression but the behavior was purposefully changed in #1208 to fix #1175. In #1175, @domdir made two proposals: href should be replaced with either: "page origin" or "page origin + pathname". As noted (While page origin + pathname is closer to the way it behaves currently, I think the correct solution, however, is to only use the page origin), the preference was for "page origin" only and that was indeed the result of #1208, but I think "page origin + pathname" has a valid usecase.

Expected behavior
I think it should be possible for an app to opt-in to the old behavior or specifying the web worker name relative to the app.

Environment:

  • Yew version: 0.16 and later

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I can work on a solution but this requires discussion
  • I don't have time to fix this right now, but maybe later

Metadata

Metadata

Assignees

Labels

A-yew-agentArea: The yew-agent cratefeature-acceptedA feature request that has been accepted and needs implementingfeature-requestA feature request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions