Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWhat is Programming And How i can Enjoy it?(24.09.2026 um 11:54 Uhr)
Sichere ProgrammierungYou Don't Need Adobe Commerce Cloud to Survive Black Friday(24.09.2026 um 11:55 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK cyber capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK Cyber Capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenThe fake worker threat and the rise of human infiltration(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenPolinRider Spreads Through Compromised GitHub Accounts and Packagist(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenWeaselBiscuit Strips BeaverTail and OtterCookie Down to Essentials(24.09.2026 um 11:59 Uhr)
Sichere ProgrammierungWhat is Programming And How i can Enjoy it?(24.09.2026 um 11:54 Uhr)
Sichere ProgrammierungYou Don't Need Adobe Commerce Cloud to Survive Black Friday(24.09.2026 um 11:55 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK cyber capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenBeyond Lazarus: Organization of DPRK Cyber Capabilities(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenThe fake worker threat and the rise of human infiltration(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenPolinRider Spreads Through Compromised GitHub Accounts and Packagist(24.09.2026 um 11:59 Uhr)
Malware / Trojaner / VirenWeaselBiscuit Strips BeaverTail and OtterCookie Down to Essentials(24.09.2026 um 11:59 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Next.js shallow search params routing

If you ever used Pages Router from Next.js you might be familiar with an ability to do shallow navigation, in App Router this option is gone from router hooks. Currently when you change anything in URL it goes to the Next.js server…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you ever used Pages Router from Next.js you might be familiar with an ability to do shallow navigation, in App Router this option is gone from router hooks. Currently when you change anything in URL it goes to the Next.js server everytime, it might be unnecessary in cases for example when you have some client only components that does not render on server, but you still want to persist the state in URL (and you probably should do pretty much always, it enhances UX), to prevent that you have to find a magic trick...



And the trick is... just use plain old browser native History API, easier said than done but let's see...




// root page.tsx
import { Suspense } from 'react';
import { ShallowParams } from './shallow-params';

// simple counter so you will clearly see that another
// roundtrip to server occured
let serverRenderCount = 0;

export default async function Home() {
console.log('Server run', serverRenderCount++);

return (
<div className="flex flex-col">
{/* Suspense is needed because we are using useSearchParams hook which would fallback Next.js to dynamic rendering always */}
<Suspense>
<ShallowParams />
</Suspense>
</div>
);
}









// shallow-params.tsx

'use client';

import { useRouter, useSearchParams } from 'next/navigation';

export function ShallowParams() {
// useSearchParams updates state even if we use History API
const params = useSearchParams();
const router = useRouter();

const count = +(params.get('count') || 0);
return (
<div className="flex flex-col gap-2">
<p>{params.get('count') || 0}</p>

<button
className="btn"
onClick={() => {
// shallow increase count params via the push. Check the browser back and forward buttons.
window.history.pushState({}, '', `/?count=${count + 1}`);
}}
>
Add to count +1 (push)
</button>
<button
className="btn"
onClick={() => {
// shallow increase count params via the replace. Check the browser back and forward buttons, the history was overridden
window.history.replaceState({}, '', `/?count=${count + 5}`);
}}
>
Add to count +5 (replace)
</button>
<button
className="btn"
onClick={() => {
// and this is a normal router action, in the server console you will see the serverRenderCount increase and log, with above methods it won't log anything.
router.push(`/?count=${count + 10}`);
}}
>
Add to count +10 (Next.js router push)
</button>
</div>
);
}






And that's pretty much it. Here is a link to StackBlitz sandbox you can play with the example from above



You can build abstractions around it and do whatever you want with shallow routing. For simple things it would be okay to use History API directly, but as always web development have many rough edge cases that would pop out at the least expected moment, that said, there is an excellent library out there called nuqs it makes search params first class citizen in Next.js (and other frameworks also!) and makes sure you won't encounter those rough edge cases.



That's it for today. Take a look at my other articles where I share some nice tricks!

SOC Incident Playbook: Vulnerability Remediation & Verification
title: Detect Exploitation - Next.js shallow search params routing
id: 3e8954b1-843a-4b36-9eb8-99050b4ff193
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Next.js shallow search params " ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Next.js shallow search params routing.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Next.js shallow search params routing

Thematisch verwandte Begriffe: Nextjs, shallow, search, params · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY Kritische Sicherheitsmeldung
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick