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

fix onload and onerror parsing error #3707

Merged
merged 2 commits into from
Feb 8, 2025

Conversation

sehnryr
Copy link
Contributor

@sehnryr sehnryr commented Feb 6, 2025

regression error induced by 299b123 where serde default got removed from load_error attribute of ImageData.

pub struct ImageData {
-     #[cfg_attr(feature = "serialize", serde(default))]
-     pub load_error: bool,
+     inner: Box<dyn HasImageData>,
}

// ...

+ struct SerializedImageData {
+     load_error: bool,
+ }

Also, it seems like neither the load nor the error events are used in serializeEvent. This could be an issue when an error event goes unnoticed and the load_error attribute is still set to false as it is the default value for bool.

Something like this could do the trick but it might be out of scope for this PR.

if (event.type === "load") {
  extend({ load_error: false })
}
if (event.type === "error") {
  extend({ load_error: true })
}

regression error induced by 299b123 where serde default got removed from `load_error` attribute of `ImageData`.

```diff
pub struct ImageData {
-     #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
-     pub load_error: bool,
+     inner: Box<dyn HasImageData>,
}

// ...

+ struct SerializedImageData {
+     load_error: bool,
+ }
```
@sehnryr sehnryr requested a review from a team as a code owner February 6, 2025 23:31
@ealmloff ealmloff added bug Something isn't working html Related to the html crate labels Feb 7, 2025
@jkelleyrtp jkelleyrtp merged commit ab91965 into DioxusLabs:main Feb 8, 2025
17 checks passed
@sehnryr sehnryr deleted the fix/image-event-serialization branch February 8, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working html Related to the html crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants