MaxwellBo / Muncoordinated-2

🇺🇳 Muncoordinated is a Model UN committee management service, (re)written with TypeScript, React, Semantic UI and Firebase.
https://muncoordinated.io/
GNU General Public License v3.0
31 stars 20 forks source link

Package-upgrade #198

Open GeordieEK opened 3 weeks ago

GeordieEK commented 3 weeks ago

Second attempt at package upgrade, (see #193) now with less formatting!!

MaxwellBo commented 2 weeks ago

LFGGGGGGGGGGG

MaxwellBo commented 2 weeks ago
image

interesting, some errors on /caucus routes

image

UPDATE: the error is bubbling up from

  // TODO: Bandaid - Another firebase type mismatch, it's expecting type Query but not entirely sure why
  skew = useObjectVal<number>(firebase.database().ref('.info/serverTimeOffset') as any);

UPDATE: okay you'll need two patches. They're using the namespaced API because there's a type between what the library expects and what compat exports:

First one in caucus.tsx, replacing

  // TODO: Improve this dirty fix
  let skew: any
  // TODO: Bandaid - Another firebase type mismatch, it's expecting type Query but not entirely sure why
  skew = useObjectVal<number>(firebase.database().ref('/.info/serverTimeOffset') as any);

  const startTimer = () => {
    toggleTicking({
      timerFref: props.fref.child('speakerTimer'),
      timer: props.speakerTimer,
      skew: skew.value
    });
  };

with

  const db = getDatabase();
  const [skew] = useObjectVal<number>(ref(db, '.info/serverTimeOffset'));
  console.log("Got skew", skew, "millis");

  const startTimer = () => {
    toggleTicking({
      timerFref: props.fref.child('speakerTimer'),
      timer: props.speakerTimer,
      skew
    });
  };

And the second one in strawpoll.tsx

export const getStrawpollRef = (committeeID: CommitteeID, strawpollID: StrawpollID) => {
  const db = getDatabase();
  return child(child(ref(db, 'committees'), committeeID), `strawpolls/${strawpollID}`)
};

Tragically this elicits a rework of Strawpoll.tsx:

image

to use the child constructors

MaxwellBo commented 2 weeks ago

Okay, so this is why the Netlify deploy is fucking up (as you said, Node version issues):

image

Going to hold off on bumping this in case it takes the site down entirely. Will pull the trigger right before merge.