Skip to content

#22 resolve rearrange tabs#23

Open
shekharmetre wants to merge 2 commits into
harshsbhat:mainfrom
shekharmetre:feature/rearrange-tabs
Open

#22 resolve rearrange tabs#23
shekharmetre wants to merge 2 commits into
harshsbhat:mainfrom
shekharmetre:feature/rearrange-tabs

Conversation

@shekharmetre

@shekharmetre shekharmetre commented Feb 25, 2025

Copy link
Copy Markdown

No description provided.

@vercel

vercel Bot commented Feb 25, 2025

Copy link
Copy Markdown

@Kalbhairu is attempting to deploy a commit to the harsh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Feb 25, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sealnotes ❌ Failed (Inspect) Feb 25, 2025 2:59pm

@harshsbhat

Copy link
Copy Markdown
Owner

It has build errors. Can you resolve them? @shekharmetre

./src/app/[...slug]/client.tsx:315:31
Type error: Argument of type '{ title: string; description: string; } | undefined' is not assignable to parameter of type '{ title: string; description: string; }'.
Type 'undefined' is not assignable to type '{ title: string; description: string; }'.
313 | const newArray = [...getValues("tabs")];
314 | const [moveditem] = newArray.splice(activeTab, 1);
> 315 | newArray.splice(index, 0, moveditem);
| ^
316 | setValue("tabs", newArray, { shouldDirty: true });
317 | setIsDirty((prev) => [...prev, false]);
318 | };
 ELIFECYCLE  Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1

@shekharmetre

Copy link
Copy Markdown
Author

const handleDrop = (index: number) => {
const newArray = [...getValues("tabs")];

// Ensure activeTab is within bounds
if (activeTab == null || activeTab < 0 || activeTab >= newArray.length) {
return;
}

const [moveditem] = newArray.splice(activeTab, 1);

// Ensure moveditem is not undefined before inserting
if (!moveditem) {
return;
}

newArray.splice(index, 0, moveditem);
setValue("tabs", newArray, { shouldDirty: true });
setIsDirty((prev) => [...prev, false]);
};
u can try this one

@harshsbhat

Copy link
Copy Markdown
Owner

why are you not pushing it on the same branch? @shekharmetre

@shekharmetre

shekharmetre commented Feb 25, 2025

Copy link
Copy Markdown
Author

Are you referring to the main branch?

@shekharmetre

Copy link
Copy Markdown
Author

I am a frontend developer and haven't learned Redis yet. In the future, if developers like me want to contribute, I can create a dummy access setup specifically for frontend developers. What do you think?

@shekharmetre

Copy link
Copy Markdown
Author

Please create an issue, and I will take care of it.

@harshsbhat

Copy link
Copy Markdown
Owner

Why do we need a different issue? Just push the changes to this branch.

@shekharmetre

shekharmetre commented Feb 25, 2025

Copy link
Copy Markdown
Author

I think the issue is that getValues should return an initial value at index 0. If activeTab or handleDrop's index is undefined, it might be causing problems because you can't rearrange a single element. If this isn't the issue, let me know, and I'll investigate further. My current problem is that I'm not connected to Redis, whereas you are using Redis in your setup. Give me some time, and I'll work on solving it i have to understand lil bit reddis .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants