Skip to content
Gx
GitHub

GX6004: unknown island load strategy

The load attribute of an island tag has a value that is not a load strategy.

Cause

The load attribute of an island tag names the time the browser loads the island file. The value is not one of the four strategies, or it is not a static value.

Value The browser loads the island
eager At once.
idle When the browser is idle.
visible When the element comes near the viewport. This is the default.
media(<query>) When the media query matches.

Example

dashboard/charts.go
package dashboard

type RevenueChartProps struct {
	Title string `json:"title"`
}
dashboard/RevenueChart.ts
export default (el: HTMLElement) => {
  el.textContent = "Revenue";
};
dashboard/Page.gx
package dashboard

<section>
  <RevenueChart title="Revenue" load="lazy" />
</section>

gx check reports:

gx check
dashboard/Page.gx:4:33: GX6004: the load attribute of <RevenueChart> has the unknown value "lazy"; use eager, idle, visible or media(<query>)

Fix

  1. Use one of the four strategies.
  2. Write a media query in single quotes around the attribute value: load='media("(min-width: 768px)")'.
  3. Remove the attribute to load the island when it is visible.