fix: vanishing widgets in protected branches (#34129)

## Description
Fixing vanishing widgets in protected branches

Fixes https://github.com/appsmithorg/appsmith/issues/34128


## Automation

/ok-to-test tags="@tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9448976837>
> Commit: b45f21e9573c872c809b4f509d735988cbfcfae7
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9448976837&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->










## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
  - Simplified logic by removing unnecessary checks for protected mode.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Rudraprasad Das 2024-06-10 19:34:54 +05:30 committed by GitHub
parent 56cfd980aa
commit 068847d4e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,6 @@ import { useSelector } from "react-redux";
import { getWidget } from "sagas/selectors";
import type { AppState } from "@appsmith/reducers";
import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
import { protectedModeSelector } from "selectors/gitSyncSelectors";
interface DropTargetComponentWrapperProps {
dropTargetProps: DropTargetComponentProps;
@ -31,12 +30,7 @@ export const DropTargetComponentWrapper = memo(
const widget = useSelector((state: AppState) =>
getWidget(state, dropTargetProps.parentId || MAIN_CONTAINER_WIDGET_ID),
);
const isProtectedMode = useSelector(protectedModeSelector);
if (
(dropTargetProps.parentId && !widget) ||
isProtectedMode ||
dropDisabled
) {
if ((dropTargetProps.parentId && !widget) || dropDisabled) {
//eslint-disable-next-line
return <>{children}</>;
}