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
33 stars 21 forks source link

Package-upgrade #198

Closed GeordieEK closed 4 months ago

GeordieEK commented 5 months ago

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

MaxwellBo commented 5 months ago

LFGGGGGGGGGGG

MaxwellBo commented 5 months 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 5 months 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.

Zhehan-Z commented 4 months ago

Is a merge possible at this time? A test deployment with V20 may work. Perhaps a test env can be set up for that.

MaxwellBo commented 4 months ago

@Zhehan-Z apologies for the delay, merging