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

[BUG] - [dnd5e] - Purely Application V2 sheet won't preview for player #691

Open
4 of 5 tasks
kgar opened this issue Jan 10, 2025 · 3 comments
Open
4 of 5 tasks

[BUG] - [dnd5e] - Purely Application V2 sheet won't preview for player #691

kgar opened this issue Jan 10, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@kgar
Copy link

kgar commented Jan 10, 2025

I confirm the following:

  • I am on the latest version of Item Piles
  • I have tried to clear my cache (Ctrl / Cmd + F5)
  • I have checked the console for errors (F12 to open, Console tab)
  • I have tried to reset Item Piles' system settings
  • I have reproduced this bug with only item piles & its dependency modules enabled

Describe the bug
When a player attempts to preview a sheet that is purely Application V2 (e.g., Tidy 5e Item Sheets), an error occurs and the sheet does not open.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a merchant with an item whose sheet is set to "Tidy 5e Item Sheet Classic"
  2. Log in as a player
  3. Have the GM show the merchant to the player
  4. Have the player try to preview the item

Expected behavior
The preview item sheet should show.

Screenshots
If applicable, add screenshots to help explain your problem.

image

Setup

  • Foundry Version: 12.331
  • System Version: 4.1.2
  • Item Piles Version: 3.1.6
  • Browser & version: Google Chrome Version 131.0.6778.265 (Official Build) (64-bit)

Active modules

  • Item Piles
  • libwrapper
  • socketlib
  • Tidy 5e Sheets

Additional context
There are 2 issues:

  1. Application V2 has a different constructor; it takes { document: newItem } instead of newItem, { editable: false }
  2. Application V2 does not have a _render function, only a render function

Here's an example of shimming the constructor for App V2 and falling back to render:

    // ... replacing the last part of PileItem.preview()
    // Shim for App V2, accommodates `{ document: newItem }`
    newItem.document = newItem;
    const sheet = new cls(newItem, { editable: false });
    if (sheet?._render) {
      sheet._render(true);
    }
    else {
      sheet.render(true)
    }

There's probably a much better way to do this where App V2 is detected and constructed separately. If I find it during foundry dev time, I will pass it along.

Tidy 5e has its own error when constructed in this preview fashion, but I am releasing a patch soon to address my side.

@kgar kgar added the bug Something isn't working label Jan 10, 2025
@crash1115
Copy link

Just wanted to jump on the train here, experienced this in both dnd5e versions 4.1.2 and 4.2.2.

@Haxxer
Copy link
Collaborator

Haxxer commented Jan 28, 2025

Be mindful of this issue: #662

@crash1115
Copy link

Be mindful of this issue: #662

Yessir, I was aware of the compatibility situation, just wanted to do my civic duty and provide additional detail since the original post only references 4.1.2 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants