Skip to content

Commit

Permalink
Merge pull request #75 from noahstreller/dependabot/npm_and_yarn/mult…
Browse files Browse the repository at this point in the history
…i-39819528c7
  • Loading branch information
noahstreller authored Oct 8, 2024
2 parents 0878016 + 05f1fb0 commit f9e3c65
Show file tree
Hide file tree
Showing 6 changed files with 276 additions and 959 deletions.
27 changes: 17 additions & 10 deletions app/sw.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { defaultCache } from "@serwist/next/browser";
import type { PrecacheEntry } from "@serwist/precaching";
import { installSerwist } from "@serwist/sw";
import { defaultCache } from "@serwist/next/worker";
import type { PrecacheEntry, SerwistGlobalConfig } from "serwist";
import { Serwist } from "serwist";

declare const self: ServiceWorkerGlobalScope & {
// Change this attribute's name to your `injectionPoint`.
// `injectionPoint` is an InjectManifest option.
// See https://serwist.pages.dev/docs/build/inject-manifest/configuring
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
};
// This declares the value of `injectionPoint` to TypeScript.
// `injectionPoint` is the string that will be replaced by the
// actual precache manifest. By default, this string is set to
// `"self.__SW_MANIFEST"`.
declare global {
interface WorkerGlobalScope extends SerwistGlobalConfig {
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
}
}

installSerwist({
declare const self: ServiceWorkerGlobalScope;

const serwist = new Serwist({
precacheEntries: self.__SW_MANIFEST,
skipWaiting: true,
clientsClaim: true,
navigationPreload: true,
runtimeCaching: defaultCache,
});

serwist.addEventListeners();
6 changes: 1 addition & 5 deletions components/create-grade-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ export function CreateGradeForm({
);
}
refresh();
if (
!preferences?.newEntitySheetShouldStayOpen ??
!defaultPreferences.newEntitySheetShouldStayOpen
)
setDrawerOpen(false);
if (!preferences?.newEntitySheetShouldStayOpen) setDrawerOpen(false);
}

return (
Expand Down
6 changes: 1 addition & 5 deletions components/grade-for-subject-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ export function CreateGradeFormForSubject({
addGradeToast(grade, subject.name ?? "");
}
refresh();
if (
!preferences?.newEntitySheetShouldStayOpen ??
!defaultPreferences.newEntitySheetShouldStayOpen
)
setDrawerOpen(false);
if (!preferences?.newEntitySheetShouldStayOpen) setDrawerOpen(false);
}

return (
Expand Down
8 changes: 5 additions & 3 deletions next.config.js → next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/** @type {import('next').NextConfig} */
const createNextIntlPlugin = require("next-intl/plugin");
import withSerwistInit from "@serwist/next";
import createNextIntlPlugin from "next-intl/plugin";

const withNextIntl = createNextIntlPlugin();
const withSerwist = require("@serwist/next").default({
const withSerwist = withSerwistInit({
swSrc: "app/sw.ts",
swDest: "public/sw.js",
disable: process.env.NODE_ENV === "development",
});

module.exports = withSerwist(
export default withSerwist(
withNextIntl({
reactStrictMode: false,
})
Expand Down
Loading

0 comments on commit f9e3c65

Please sign in to comment.