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

"slot is not iterable" error in frontend #77

Closed
duck-master opened this issue Nov 18, 2024 · 3 comments
Closed

"slot is not iterable" error in frontend #77

duck-master opened this issue Nov 18, 2024 · 3 comments

Comments

@duck-master
Copy link
Contributor

When I do nvm use 16 and npm start on a freshly cloned version of the hydrant repository (after regenerating latest.json and npm install), I get this screen:
Screenshot 2024-11-17 at 7 16 45 PM

and if I go into the browser console I get the following error message:

Uncaught (in promise) TypeError: slot is not iterable
    timeslots class.ts:63
    Section class.ts:63
    sections class.ts:120
    Sections class.ts:120
    sections class.ts:202
    Class class.ts:198
    State state.ts:68
    State state.ts:67
    useHydrant App.tsx:67

and the offending code in class.ts is

  /** @param section - raw section info (timeslot and room) */
  constructor(secs: Sections, rawTime: string, section: RawSection) {
    this.secs = secs;
    this.rawTime = rawTime;
    const [rawSlots, room] = section;
    this.timeslots = rawSlots.map((slot) => new Timeslot(...slot));
    this.room = room;
  }

This error appears in both my own branch and the freshly-cloned version, so I think this is likely an issue with the frontend or the current JSON schema, or possibly both.

@cjquines
Copy link
Member

cjquines commented Nov 20, 2024

sounds like rawSlots is of the incorrect type, can you log it?

@duck-master
Copy link
Contributor Author

duck-master commented Nov 26, 2024

I recloned everything and the code magically fixed itself. Weird. One of these days I want to make a pull request that does input validation for latest.json. That said, I think it would actually be a lot cleaner to centralize all of the course data into a huge database and then expose that via an API wrapper.

EDIT: pull requests -> pull request

@psvenk
Copy link
Member

psvenk commented Nov 26, 2024

Sorry, I didn't see this before :/ The issue was that efb5556 was present on deploy but not on main (after I inadvertently broke things in 548e5b2 and then forgot to push the fix to main for some reason).

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

No branches or pull requests

3 participants