Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): ENG-503 wire up the func editor to the router #1238

Merged
merged 1 commit into from
Aug 29, 2022

Conversation

zacharyhamm
Copy link
Contributor

@zacharyhamm zacharyhamm commented Aug 29, 2022

Appending a func id to the workspace lab route will open the func by that id. Func selection is now driven by route pushes.

@linear
Copy link

linear bot commented Aug 29, 2022

@netlify
Copy link

netlify bot commented Aug 29, 2022

👷 Deploy request for system-init-corp pending review.

A Netlify team Owner will need to approve the deploy before you can run your build.

Are you a team Owner? Visit the deploys page to approve it

Need more help? Learn more in the Netlify docs

Name Link
🔨 Latest commit 5c86fa2

@github-actions github-actions bot added the A-web label Aug 29, 2022
@zacharyhamm zacharyhamm force-pushed the zacharyhamm/eng-503-wire-func-editor-to-router branch from 6c63b3c to b7068db Compare August 29, 2022 20:51
@@ -19,8 +19,8 @@
class="grow overflow-x-hidden overflow-y-hidden dark:bg-neutral-800 dark:text-white text-lg font-semi-bold px-2 pt-2 flex flex-col"
>
<FuncEditorTabs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be a little annoying, but if you can set this up to use RouterLink components (from vue-router) then it will enable right click to open in a new tab.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah that's a good call

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't make that happen until this tailwindlabs/headlessui#1680 fix gets bundled into a release for headless UI (or we could pull headless ui directly from github instead of the npm package). It's the source of a few glitches in the app currently that I was very confused about until I realized that the tab group is not in fact acting as a controlled component.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah shoot. Headless ui is pretty neat and useful in some places, but definitely causes some problems in others… might want to ditch it for tabs in favor of something we build.

@zacharyhamm
Copy link
Contributor Author

bors r+

@zacharyhamm
Copy link
Contributor Author

bors r-

@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Aug 29, 2022

Canceled.

@@ -64,9 +65,25 @@ import { visibility$ } from "@/observable/visibility";
import { saveFuncToBackend$ } from "@/observable/func";
import { clearFuncs } from "../FuncEditor/func_state";

const props = defineProps<{ funcId?: string }>();

const selectedFuncId = computed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more thing - in the past I've set up a router hook/guard to automatically cast the props numbers where appropriate. Just removes some annoying code on routes where we are using it...

router.beforeEach(async (to, from, next) => {
  // automatically cast any integer params into proper integers
  // so that components can set params to expect a Number
  // NOTE - this is so that when we user router link or programatically navigate
  // that we can set the param as an int
  if (to.params) {
    const castNumericParams = _.mapValues(to.params, (val) => {
      if (parseInt(val).toString() === val) return parseInt(val);
      return val;
    });
    if (_.isEqual(castNumericParams, to.params)) return next();
    return next({
      ...to,
      params: castNumericParams,
    });
  }

  return next();
});

@zacharyhamm zacharyhamm force-pushed the zacharyhamm/eng-503-wire-func-editor-to-router branch from b7068db to 5c86fa2 Compare August 29, 2022 21:37
@zacharyhamm
Copy link
Contributor Author

bors r+

@si-bors-ng
Copy link
Contributor

si-bors-ng bot commented Aug 29, 2022

@si-bors-ng si-bors-ng bot merged commit 02f8396 into main Aug 29, 2022
@si-bors-ng si-bors-ng bot deleted the zacharyhamm/eng-503-wire-func-editor-to-router branch August 29, 2022 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants