(props: ScriptProps)
| 90 | /// </div> |
| 91 | #[component] |
| 92 | pub fn Script(props: ScriptProps) -> Element { |
| 93 | use_update_warning(&props, "Script {}"); |
| 94 | |
| 95 | use_hook(|| { |
| 96 | let document = document(); |
| 97 | let mut insert_script = document.create_head_component(); |
| 98 | if let Some(src) = &props.src { |
| 99 | if !should_insert_script(src) { |
| 100 | insert_script = false; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | if !insert_script { |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | // Make sure the props are in a valid form - they must either have a source or children |
| 109 | if let (None, Err(err)) = (&props.src, props.script_contents()) { |
| 110 | // If the script has neither contents nor src, log an error |
| 111 | err.log("Script") |
| 112 | } |
| 113 | |
| 114 | document.create_script(props); |
| 115 | }); |
| 116 | |
| 117 | VNode::empty() |
| 118 | } |
| 119 | |
| 120 | #[derive(Default, Clone)] |
| 121 | struct ScriptContext(DeduplicationContext); |
nothing calls this directly
no test coverage detected