Skip to content

feat: add WebView::load_html for loading HTML after intialization#1368

Merged
amrbashir merged 3 commits intotauri-apps:devfrom
just-be-dev:load-html
Sep 25, 2024
Merged

feat: add WebView::load_html for loading HTML after intialization#1368
amrbashir merged 3 commits intotauri-apps:devfrom
just-be-dev:load-html

Conversation

@just-be-dev
Copy link
Copy Markdown
Contributor

@just-be-dev just-be-dev commented Sep 25, 2024

This PR aims to implement load_html, a companion of load_url to balance out the current implementation. Currently, the webview can be initialized with either a URL or HTML via .with_url or .with_html in the builder. After creation .load_url can be used to load a different URL, but the same can't be said for .load_html.

In #1367 I noted that refreshing a webview initialized with .load_html causes the webview to be left with an empty screen. While that's not ideal, if this method existed it'd be easy enough to simply call load_html with the same payload as what the webview was initialized with to get it back in the correct state.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 25, 2024

Package Changes Through 481a199

There are 1 changes which include wry with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
wry 0.44.1 0.45.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@just-be-dev just-be-dev changed the title Implement load_html for loading HTML after intialization feat: Implement load_html for loading HTML after intialization Sep 25, 2024
@just-be-dev just-be-dev marked this pull request as ready for review September 25, 2024 14:30
@just-be-dev just-be-dev requested a review from a team as a code owner September 25, 2024 14:30
@just-be-dev
Copy link
Copy Markdown
Contributor Author

I've got a PR in my library that tests the code path for this PR: just-be-dev/webview#56. That's what I've used to test the implementation.

@just-be-dev
Copy link
Copy Markdown
Contributor Author

I got someone at Recurse to verify that it works on windows as well. Still need to test on linux, but I'll get someone for that soon. My library isn't really setup to be ran on iOS or android so I'd appreciate extra scrutiny there. Overall the implementation seems straight forward though.

Copy link
Copy Markdown
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

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

Thank you

@amrbashir amrbashir changed the title feat: Implement load_html for loading HTML after intialization feat: add WebView::load_html for loading HTML after intialization Sep 25, 2024
@amrbashir amrbashir merged commit e332eff into tauri-apps:dev Sep 25, 2024
@just-be-dev just-be-dev deleted the load-html branch September 26, 2024 18:41
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.

2 participants