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

Split out editing venues from editing schedule #10028

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

kr-matthews
Copy link
Contributor

image

image

The styling is a bit off with the "Venues + Add a venue" and the text at the top of each tab being a bit close to the content below (formerly there was an accordion).

Now each folder has an index and a (single) component subfolder with another index, so it might be worth bringing those subfolder contents up and having a single index (maybe as a follow-up PR?).

There's some minor duplication now, since everything was duplicated then trimmed away, mostly in the 2 top-level index files.

I removed a scss file because it didn't appear to be doing anything, but I'm not 100% confident in this.

@kr-matthews kr-matthews self-assigned this Oct 5, 2024
@kr-matthews kr-matthews requested a review from gregorbg October 6, 2024 19:39
Copy link
Contributor Author

@kr-matthews kr-matthews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried and nothing on the venues page nor on the schedule page saves - when I refresh, the original (old) data reappears.
I can successfully edit events.


save(url, wcifData, onSuccess, options, onError);
},
[save],
[save, patchOpts],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're passing patchOpts as an object (useSaveWcifAction({ skipSchedule: true })) which means this will be a fresh object (reference) each render, so this saveWcif will re-compute every time, negating the use of useCallback. If any code is relying on saveWcif never re-computing (i.e. using saveWcif in a dependency array somewhere), then this will break that code.

This can be avoided by defining const wcifSaveOptions = { skipSchedule: true } outside the component. But it doesn't prevent anyone in the future from passing in an object 'incorrectly.'

(I'm not sure if the default value {} is a fresh object each time?)

Making the options a parameter to save, instead of the hook itself, might work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Should now be less recompute-heavy. And this incidentally also fixes the error with the backend not saving, because the PATCH request was accidentally passing undefined in the URL under certain circumstances.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me, and works well as far as I can tell.

I wonder if specifying what should be saved, rather than what should not be saved, might be better though? In the past I have been editing groups in delegate dashboard, and also editing the schedule on the site, and overwritten myself, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No wait, adding rooms might still cause conflicts when editing in different browser tabs. I will investigate more tomorrow. But your changes certainly haven't made anything worse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things that can go wrong with 2 tabs open for venues/schedule respectively:

  • Delete a venue/room & save, then edit the schedule in that room & save -> 'invalid json' error
  • Copy an existing room (in venue editor) & save, then edit anything in the schedule & save -> new copied room is gone
  • Maybe other scenarios

Simple things like editing the fields of venues/rooms while editing the schedule seem to work fine, as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants