fix: tidying up the survey card header (#6341)

Co-authored-by: Jakob Schott <jakob@formbricks.com>
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Victor Santos <victor@formbricks.com>
Co-authored-by: Jakob Schott <154420406+jakobsitory@users.noreply.github.com>
This commit is contained in:
Anshuman Pandey
2025-08-08 15:48:56 +05:30
committed by GitHub
parent ec6d88bf11
commit 62166dc4b1
28 changed files with 365 additions and 193 deletions
@@ -69,10 +69,11 @@ async function checkRedisAvailability() {
* - Failure Indicates: TTL or window calculation issues
*
* 5. High Throughput Stress Test
* - Purpose: Test performance under sustained load
* - Method: 200 requests in batches (limit: 50)
* - Purpose: Test performance under sustained load within single time window
* - Method: 200 concurrent requests (limit: 50)
* - Expected: Exactly 50 requests allowed, consistent performance
* - Failure Indicates: Performance degradation or counter corruption
* - Note: Fixed to send all requests concurrently to avoid window boundary race conditions
*
* 6. applyRateLimit Function Test
* - Purpose: Test the higher-level wrapper function
@@ -315,29 +316,27 @@ describe("Rate Limiter Load Tests - Race Conditions", () => {
const config = TEST_CONFIGS.high;
const totalRequests = 200;
const batchSize = 50;
const identifier = "stress-test";
let totalAllowed = 0;
let totalDenied = 0;
// Send requests in batches to simulate real load
for (let i = 0; i < totalRequests; i += batchSize) {
const batchEnd = Math.min(i + batchSize, totalRequests);
const batchPromises = Array.from({ length: batchEnd - i }, () => checkRateLimit(config, identifier));
const batchResults = await Promise.all(batchPromises);
const batchAllowed = batchResults.filter((r) => r.ok && r.data.allowed).length;
const batchDenied = batchResults.filter((r) => r.ok && !r.data.allowed).length;
totalAllowed += batchAllowed;
totalDenied += batchDenied;
// Small delay between batches
await new Promise((resolve) => setTimeout(resolve, 10));
// Clear any existing keys first to ensure clean state
const redis = getRedisClient();
if (redis) {
const existingKeys = await redis.keys(`fb:rate_limit:${config.namespace}:*`);
if (existingKeys.length > 0) {
await redis.del(existingKeys);
}
}
// Send ALL requests concurrently within the same time window
// This eliminates window boundary race conditions that caused intermittent failures
const allPromises = Array.from({ length: totalRequests }, () => checkRateLimit(config, identifier));
console.log(`Sending ${totalRequests} concurrent requests...`);
const results = await Promise.all(allPromises);
const totalAllowed = results.filter((r) => r.ok && r.data.allowed).length;
const totalDenied = results.filter((r) => r.ok && !r.data.allowed).length;
console.log(`Stress test: ${totalAllowed} allowed, ${totalDenied} denied`);
// Should respect the rate limit even under high load
@@ -62,7 +62,7 @@ export function DefaultLanguageSelect({
<SelectContent>
{projectLanguages.map((language) => (
<SelectItem
className="xs:text-base px-0.5 py-1 text-xs text-slate-800 dark:bg-slate-700 dark:text-slate-300 dark:ring-slate-700"
className="px-0.5 py-1 text-sm text-slate-800"
key={language.id}
value={language.code}>
{`${getLanguageLabel(language.code, locale)} (${language.code})`}
@@ -215,7 +215,8 @@ export const MultiLanguageCard: FC<MultiLanguageCardProps> = ({
checked={isMultiLanguageActivated}
disabled={!isMultiLanguageAllowed || projectLanguages.length === 0}
id="multi-lang-toggle"
onClick={() => {
onClick={(e) => {
e.stopPropagation();
handleActivationSwitchLogic();
}}
/>
@@ -239,7 +239,7 @@ export function LogicEditorActions({
)}
</div>
<DropdownMenu>
<DropdownMenuTrigger id={`actions-${idx}-dropdown`}>
<DropdownMenuTrigger id={`actions-${idx}-dropdown`} asChild>
<Button
variant="outline"
className="flex h-10 w-10 items-center justify-center rounded-md bg-white">
@@ -8,8 +8,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/modules/ui/components/dropdown-menu";
import { InputCombobox } from "@/modules/ui/components/input-combo-box";
import { TComboboxOption } from "@/modules/ui/components/input-combo-box";
import { InputCombobox, TComboboxOption } from "@/modules/ui/components/input-combo-box";
import {
Select,
SelectContent,
@@ -207,7 +206,7 @@ export function ConditionsEditor({ conditions, config, callbacks, depth = 0 }: C
</div>
<DropdownMenu>
<DropdownMenuTrigger id={`condition-${depth}-${index}-dropdown`}>
<DropdownMenuTrigger id={`condition-${depth}-${index}-dropdown`} asChild>
<Button
variant="outline"
className="flex h-10 w-10 items-center justify-center rounded-md bg-white">
@@ -504,7 +504,7 @@ export const ToolbarPlugin = (props: TextEditorProps & { container: HTMLElement
<DropdownMenuContent align="start">
{Object.keys(blockTypeToBlockName).map((key) => {
return (
<DropdownMenuItem key={key}>
<DropdownMenuItem key={key} asChild>
<Button
type="button"
onClick={() => format(key)}
+1
View File
@@ -271,6 +271,7 @@ test.describe("Multi Language Survey Create", async () => {
await page.getByText("Start from scratch").click();
await page.getByRole("button", { name: "Create survey", exact: true }).click();
await page.locator("#multi-lang-toggle").click();
await page.getByText("Multiple languages").click();
await page.getByRole("combobox").click();
await page.getByLabel("English (en)").click();
await page.getByRole("button", { name: "Confirm" }).click();