eventespresso / barista

Javascript modules & tools for Event Espresso development
GNU General Public License v3.0
5 stars 1 forks source link

Modify Ticket Status When Datetime Status Changes #1285

Open tn3rb opened 8 months ago

tn3rb commented 8 months ago

⚠️ This PR requires Cafe branch NEW/CORE/datetime-status ⚠️

With the new Datetime status changer, it is not obvious why a ticket may not be available for purchase if its related datetime makes it unavailable (like a cancelled datetime).

This PR:

testing

alexkuc commented 8 months ago

@tn3rb ⚠️ E2E has failed here. I double checked, it is not a fluke. Here's the error message:

Cannot read properties of undefined (reading 'id')
TypeError: Cannot read properties of undefined (reading 'id')
    at y (https://chromium.ddev.site:8000/wp-content/plugins/barista/build/static/js/edtrServices.3244fcfa.js?ver=5.0.13.rc.019:2:71512)
    at x (https://chromium.ddev.site:8000/wp-content/plugins/barista/build/static/js/tickets-card-view.19eacb7e.chunk.js:1:7232)
    at renderWithHooks (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:16315:20)
    at mountIndeterminateComponent (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:20084:15)
    at beginWork (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:21597:18)
    at HTMLUnknownElement.callCallback (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:4151:16)
    at Object.invokeGuardedCallbackDev (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:4200:18)
    at invokeGuardedCallback (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:4264:33)
    at beginWork$1 (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:27461:9)
    at performUnitOfWork (https://chromium.ddev.site:8000/wp-includes/js/dist/vendor/react-dom.js?ver=18.2.0:26567:14)

It looks like EDTR has failed to initialize, not related to any particular action.

Edit: link to E2E runner log - https://github.com/eventespresso/barista/actions/runs/7400794800

tn3rb commented 8 months ago

/run-e2e

alexkuc commented 8 months ago

Running E2E locally now…

Repo Branch Commit
E2E MAIN bfbfe9b
Barista MOD/datetime-status-enhancements 84346e1c
Cafe DEV 9b77c3c0ad
alexkuc commented 8 months ago

EDTR does not initialize on page load (admin). Clearing EE data did not help. The error is the same as from GH runner log:

Uncaught TypeError: Cannot read properties of undefined (reading 'id')
    at y (modifyTicketStatusBasedOnDatetimes.ts:16:16)
    at x (TicketCard.tsx:15:17)
    at renderWithHooks (react-dom.js?ver=18.2.0:16315:20)
    at mountIndeterminateComponent (react-dom.js?ver=18.2.0:20084:15)
    at beginWork (react-dom.js?ver=18.2.0:21597:18)
    at HTMLUnknownElement.callCallback (react-dom.js?ver=18.2.0:4151:16)
    at Object.invokeGuardedCallbackDev (react-dom.js?ver=18.2.0:4200:18)
    at invokeGuardedCallback (react-dom.js?ver=18.2.0:4264:33)
    at beginWork$1 (react-dom.js?ver=18.2.0:27461:9)
    at performUnitOfWork (react-dom.js?ver=18.2.0:26567:14)

Edit: There is a dependency on Cafe's branch. I have I updated the initial description to indicate that.

alexkuc commented 8 months ago

After switching to appropriate Cafe branch, locally tests have passed (twice). Going to investigate if possible to somehow override branch for GitHub's PR.

alexkuc commented 7 months ago

Running E2E locally:

Point Barista repo to branch MOD/datetime-status-enhancements… ✅ Compile prod assets for Barista repo using yarn build… ✅ Point Cafe repo to branch NEW/CORE/datetime-status… ✅ Point E2E repo to MAIN branch… ✅ Run yarn test… ❌

Edit: looks like something is failing

alexkuc commented 7 months ago

@tn3rb with the latest change I am getting issues with EDTR, both, with E2E and when working with it manually.

Steps to reproduce:

I get error "error creating datetime" and the EDTR crashes.

Error message:

Uncaught TypeError: Cannot read properties of undefined (reading 'id')
    at y (modifyTicketStatusBasedOnDatetimes.ts:16:16)
    at x (TicketCard.tsx:15:17)
    at renderWithHooks (react-dom.js?ver=18.2.0:16315:20)
    at updateFunctionComponent (react-dom.js?ver=18.2.0:19598:22)
    at beginWork (react-dom.js?ver=18.2.0:21611:18)
    at HTMLUnknownElement.callCallback (react-dom.js?ver=18.2.0:4151:16)
    at Object.invokeGuardedCallbackDev (react-dom.js?ver=18.2.0:4200:18)
    at invokeGuardedCallback (react-dom.js?ver=18.2.0:4264:33)
    at beginWork$1 (react-dom.js?ver=18.2.0:27461:9)
    at performUnitOfWork (react-dom.js?ver=18.2.0:26567:14)

Edit: If I refresh the Event page, I can see the datetime with status TBD

Edit2: If I add extra parameters to datetime like change start date or change capacity, I can see they are preserved on page reload

tn3rb commented 7 months ago

ok thnx, will look into that

tn3rb commented 7 months ago

/run-e2e

alexkuc commented 7 months ago

@tn3rb Running E2E won't work for now because the workflow for PR is hardcoded to the trunk of the Cafe's repo and this PR requires Cafe to use branch NEW/CORE/datetime-status. I've started work on a workflow update to support manually triggering E2E where you can override the branch names but I've run into issue where on approval, the git references are missing. Currently, I am powering through the e2e spec for csv. In the meantime, please ping me on Slack to run E2Es for you locally to avoid stalling this PR.

alexkuc commented 6 months ago

Gonna update e2e once this is merged

tn3rb commented 6 months ago

@alexkuc pushed a BUNCH of changes, plz re-review

alexkuc commented 6 months ago

@tn3rb Since my last review, no files were marked as changed (the GitHub's UI x / y files viewed). Was this just a rebase without any changes and I need to just rubber stamp?

Edit: By the way, have you seen my comments above? The ones from the last review.

tn3rb commented 6 months ago

@alexkuc re:

Since my last review, no files were marked as changed

my apologies, i DID miss your comments from your last review some how, and added my note in case you weren't sure whether to re-review. thnx

Pebblo commented 4 months ago

@tn3rb when I run yarn build on this branch I'm getting:

Creating an optimized production build...
Failed to compile.

C:/laragon/www/ee4cafe/wp-content/plugins/barista/packages/edtr-services/src/apollo/mutations/tickets/useOptimisticResponse.ts
TypeScript error in C:/laragon/www/ee4cafe/wp-content/plugins/barista/packages/edtr-services/src/apollo/mutations/tickets/useOptimisticResponse.ts(7,15):
',' expected.  TS1005

     5 | import { ucFirst, uuid } from '@eventespresso/utils';
     6 |
  >  7 | import { type Ticket, TicketStatus } from '../../';
       |               ^
     8 | import { useLazyTicket } from '../../queries';
     9 |
    10 | export const TICKET_DEFAULTS: Ticket = {

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.