Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Oct 11, 2023
  2. Oct 10, 2023
  3. Oct 09, 2023
  4. Oct 08, 2023
  5. Oct 06, 2023
    • Cam Saul's avatar
      Unverified
      d9301a17
    • Alexander Polyankin's avatar
      Mantine Divider (#34392) · e1ebf600
      Alexander Polyankin authored
      Unverified
      e1ebf600
    • Ryan Laurie's avatar
    • Nemanja Glumac's avatar
    • Denis Berezin's avatar
      [33482] Add more unit tests for all implemented drills (#33974) · 8f87659c
      Denis Berezin authored
      * Add more drills tests, unify tests structure, add issues refs
      
      * Add tests for fk-details drill apply
      
      * Tests fixes after merge with master
      
      * Code review fixes
      
      * Comment failing tests after merging with master
      
      * Restore sort drill tests
      Unverified
      8f87659c
    • Emmad Usmani's avatar
      Mantine Switch (#34005) · d9aa16e2
      Emmad Usmani authored
      
      * wip
      
      * Add comma and fix spelling error
      
      * Added some padding and things
      
      * switch control styles
      
      * text styles
      
      * add storybook examples
      
      * Add guidance text
      
      * Add top padding for small switches
      
      * change default size from `sm` to `md`
      
      * fix missing default `size` prop
      
      * fix paddings
      
      * remove label padding if empty
      
      * use `getStylesRef`
      
      ---------
      
      Co-authored-by: default avatarOisin Coveney <oisin@metabase.com>
      Co-authored-by: default avatarMaz Ameli <maz@metabase.com>
      Unverified
      d9aa16e2
    • Cam Saul's avatar
    • Braden Shepherdson's avatar
      Hack to fix webpack serving stale CLJS on browser refresh (#34381) · 682215fd
      Braden Shepherdson authored
      ### Background
      
      CLJS output is not watched by webpack. (Watching it causes full page reloads I can't find a way to stop.)
      CLJS changes are hot reloaded by shadow-cljs separate from webpack.
      
      Changing CLJS code works great: shadow-cljs hot reloads it and it works nicely.
      
      Changing JS code also works: webpack recompiles (including the latest CLJS output), the browser refreshes, and all is
      well.
      
      ### The Problem
      
      If you refresh the browser after you've changed only CLJS code, webpack does not know it must recompile the bundles.
      Therefore it serves up the old bundles, which have now-stale CLJS output in them.
      
      ### The "Solution"
      
      The first time shadow-cljs hot reloads after a CLJS change, a hook in `metabase.util.devtools` registers a
      `beforeunload` handler. This handler sends a request to `http://localhost:8080/webpack-dev-server/invalidate`, forcing
      webpack to recompile the bundles.
      
      That isn't such a terrible hack by itself. The ugly part is that there's a race
      condition between webpack invalidating the bundles and the browser trying to
      load the bundles after the refresh, and sometimes the browser wins (loading the
      stale CLJS). I added a spin-lock, repeatedly checking `performance.now()` until
      500ms have passed, then the handler returns. This small delay gives webpack
      time to mark the bundles invalid and allow the refresh.
      
      I haven't experimented with how long that delay needs to be for this to be
      reliable. Since this handler is only attached after CLJS code has been hot
      reloaded, it will never run for most FE devs.
      
      ### Alternative: Smarter webpack
      
      The best solution would be to make webpack
      - recompile the bundles when the CLJS output changes; but
      - not try to HMR them (which triggers a browser refresh and ruins CLJS hot reloading)
      but I have not found any way to configure this out of the box. I think it would require patching `ReactRefreshPlugin`,
      a nontrivial job. It might also be possible for shadow-cljs to poke webpack after it finishes building, but there's the
      same problem that webpack will want to HMR.
      
      Webpack doesn't support any "lazy" invalidation; as far as I know there's no
      way to say "this bundle is now invalid but don't recompile it until someone
      tries to GET it" or anything like that.
      
      ### Alternative: Block refresh then continue
      
      The `beforeunload` handler could instead work like this:
      - `preventDefault()` on the event, stopping the refresh.
      - `fetch()` the `invalidate` route as above.
      - asynchronously, when that `fetch()` is done and we know webpack has invalidated the bundles, trigger a refresh.
      
      I haven't tried this, since it seems more complicated than the spin-lock. We just need to give the `invalidate` request
      a head start.
      Unverified
      682215fd
Loading