DevNatan / inventory-framework

Minecraft Inventory API framework
MIT License
128 stars 22 forks source link

java.lang.NullPointerException: ComponentPhase root cannot be null #653

Open xF3d33 opened 8 months ago

xF3d33 commented 8 months ago

Is there an existing issue for this?

πŸ› Describe the bug

When i try to open a computedAsyncPaginationState it doesn't open the gui and throws that error. i saw another issue about this problem but i don't know if it is exactly the same as this.

`private final State paginationState = computedAsyncPaginationState( (context) -> fetchWantedsFromDatabase(), (ctx, builder, index, value) -> { builder.buildComponent(ctx.getRoot()).getContainer().renderItem(index, new ItemStack(Material.EGG)); });

@Override
public void onInit(ViewConfigBuilder config) {
    config.title("Lista ricercati");
    config.size(45);
}

@Override
public void onFirstRender(@NotNull RenderContext render) {
    final Pagination pagination = paginationState.get(render);

    render.lastSlot(new ItemStack(Material.CLOCK))
            .displayIf(pagination::isLoading)
            .updateOnStateChange(paginationState);
}

private CompletableFuture<List<Wanted>> fetchWantedsFromDatabase() {
    return Ricercati.getInstance().supplyAsync(() -> Ricercati.getInstance().getDatabase().getAllRicercati());
}`

βœ”οΈ Expected behavior

the gui to open

πŸ‘£ Steps to Reproduce

create a computedAsyncPaginationState and add items

πŸ’» Platform

⭐ Server Version

1.19.4

πŸ“š Library Version

v3.1.0-rc

✍️ Additional context

No response