jack off backwards with mine preanits
Some checks failed
Nicolium CI / Test and upload artifacts (22.x) (push) Has been cancelled
Nicolium CI / release (push) Has been cancelled
Nicolium CI / deploy (push) Has been cancelled
pl-api CI / Test for pl-api formatting (22.x) (push) Has been cancelled
pl-hooks CI / Test for a successful build (22.x) (push) Has been cancelled

This commit is contained in:
2026-03-23 01:34:05 +00:00
parent bbe25faabe
commit ca2acf3cff
2 changed files with 28 additions and 25 deletions

View File

@ -11,24 +11,12 @@ const getSpritesheetURL = () => spritesheetURL;
const getImageURL = (set: string, name: string) => joinPublicPath(`/packs/emoji/${name}.svg`);
const Picker: React.FC<any> = (props) => {
const ref = useRef<HTMLDivElement>(null);
const ref = useRef(null);
useEffect(() => {
const input = { ...props, data, ref, autoFocus: true, getImageURL, getSpritesheetURL };
new EmojiPicker(input);
// Force a reflow on the shadow DOM scroll container so unicode emojis
// render immediately on mobile instead of waiting for user interaction.
requestAnimationFrame(() => {
const picker = ref.current?.querySelector('em-emoji-picker');
const scrollable = picker?.shadowRoot?.querySelector('.scroll');
if (scrollable) {
(scrollable as HTMLElement).style.overflow = 'hidden';
void (scrollable as HTMLElement).offsetHeight;
(scrollable as HTMLElement).style.overflow = '';
}
});
}, []);
return <div ref={ref} />;

View File

@ -328,7 +328,7 @@ const handleNotificationClick = (event: NotificationEvent) => {
// --- Asset caching ---
const CACHE_NAME = 'ncd-assets-v1';
const CACHE_NAME = 'ncd-assets-v2';
/** URL patterns to cache with a cache-first strategy. */
const CACHEABLE_PATTERNS = [
@ -341,24 +341,38 @@ const CACHEABLE_PATTERNS = [
const isCacheable = (url: string): boolean =>
CACHEABLE_PATTERNS.some((pattern) => pattern.test(url));
/** Cache-first fetch handler for static assets. */
/** Cache-first fetch handler for static assets. Falls back to network on any error. */
const handleFetch = (event: FetchEvent) => {
const { request } = event;
if (request.method !== 'GET' || !isCacheable(request.url)) return;
event.respondWith(
caches.match(request).then((cached) => {
if (cached) return cached;
caches
.match(request)
.then((cached) => {
if (cached) return cached;
return fetch(request).then((response) => {
if (response.ok) {
const clone = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(request, clone));
}
return response;
});
}),
return fetch(request).then((response) => {
if (response.ok && response.status === 200) {
const clone = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(request, clone));
}
return response;
});
})
.catch(() => fetch(request)),
);
};
/** Clean up old caches on activation. */
const handleActivate = (event: ExtendableEvent) => {
event.waitUntil(
caches
.keys()
.then((keys) =>
Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))),
),
);
};
@ -366,3 +380,4 @@ const handleFetch = (event: FetchEvent) => {
self.addEventListener('push', handlePush);
self.addEventListener('notificationclick', handleNotificationClick);
self.addEventListener('fetch', handleFetch);
self.addEventListener('activate', handleActivate);